From a52250a91e24733ce798ad8baa4597032d49d11e Mon Sep 17 00:00:00 2001
From: Jon Evans
Date: Mon, 20 Feb 2017 17:57:41 +0100
Subject: [PATCH] Change from EDA_COLOR_T to COLOR4D globally; arbitrary color
support
eeschema now supports arbitrary colors for all object types, and
pcbnew does in GAL canvas. When switching from GAL to legacy canvas,
pcbnew will convert colors to the nearest legacy color.
---
3d-viewer/3d_canvas/cinfo3d_visu.cpp | 23 +-
3d-viewer/3d_canvas/cinfo3d_visu.h | 2 +-
3d-viewer/3d_canvas/create_layer_items.cpp | 2 +-
3d-viewer/CMakeLists.txt | 7 +-
bitmap2component/CMakeLists.txt | 1 +
common/block_commande.cpp | 2 +-
common/class_bitmap_base.cpp | 2 +-
common/class_colors_design_settings.cpp | 19 +-
common/class_layer_box_selector.cpp | 3 +-
common/common.cpp | 4 +-
common/common_plotDXF_functions.cpp | 29 ++-
common/common_plotGERBER_functions.cpp | 2 +-
common/common_plotPDF_functions.cpp | 2 +-
common/common_plotPS_functions.cpp | 17 +-
common/common_plotSVG_functions.cpp | 4 +-
common/common_plot_functions.cpp | 2 +-
common/config_params.cpp | 27 +-
common/draw_frame.cpp | 13 +-
common/draw_panel.cpp | 24 +-
common/drawtxt.cpp | 22 +-
common/eda_text.cpp | 10 +-
common/gal/color4d.cpp | 246 +++++++++++++++++-
common/gr_basic.cpp | 117 +++++----
common/msgpanel.cpp | 14 +-
.../page_layout/class_worksheet_dataitem.cpp | 8 +-
.../page_layout/page_layout_graphic_items.cpp | 22 +-
common/page_layout/title_block_shapes.cpp | 4 +-
common/painter.cpp | 9 -
common/selcolor.cpp | 24 +-
common/swig/kicad.i | 1 +
common/worksheet.cpp | 4 +-
common/worksheet_viewitem.cpp | 3 +-
cvpcb/class_DisplayFootprintsFrame.cpp | 4 +-
cvpcb/class_DisplayFootprintsFrame.h | 2 +-
eeschema/CMakeLists.txt | 1 +
eeschema/bus-wire-junction.cpp | 3 +-
eeschema/class_libentry.cpp | 6 +-
eeschema/class_libentry.h | 2 +-
eeschema/class_sch_screen.h | 2 +-
eeschema/dialogs/dialog_choose_component.cpp | 4 +-
eeschema/dialogs/dialog_lib_edit_pin.cpp | 4 +-
.../dialogs/dialog_print_using_printer.cpp | 4 +-
eeschema/dialogs/dialog_rescue_each.cpp | 4 +-
eeschema/eeredraw.cpp | 2 +-
eeschema/eeschema.cpp | 62 ++---
eeschema/eeschema_config.cpp | 8 +-
eeschema/general.h | 12 +-
eeschema/lib_arc.cpp | 10 +-
eeschema/lib_arc.h | 4 +-
eeschema/lib_bezier.cpp | 8 +-
eeschema/lib_bezier.h | 2 +-
eeschema/lib_circle.cpp | 8 +-
eeschema/lib_circle.h | 2 +-
eeschema/lib_draw_item.cpp | 6 +-
eeschema/lib_draw_item.h | 16 +-
eeschema/lib_field.cpp | 17 +-
eeschema/lib_field.h | 4 +-
eeschema/lib_pin.cpp | 30 +--
eeschema/lib_pin.h | 10 +-
eeschema/lib_polyline.cpp | 8 +-
eeschema/lib_polyline.h | 2 +-
eeschema/lib_rectangle.cpp | 8 +-
eeschema/lib_rectangle.h | 2 +-
eeschema/lib_text.cpp | 10 +-
eeschema/lib_text.h | 2 +-
eeschema/libeditframe.cpp | 8 +-
eeschema/pinedit.cpp | 6 +-
eeschema/protos.h | 4 +-
eeschema/sch_base_frame.cpp | 4 +-
eeschema/sch_base_frame.h | 4 +-
eeschema/sch_bitmap.cpp | 4 +-
eeschema/sch_bitmap.h | 2 +-
eeschema/sch_bus_entry.cpp | 6 +-
eeschema/sch_bus_entry.h | 2 +-
eeschema/sch_component.cpp | 2 +-
eeschema/sch_component.h | 6 +-
eeschema/sch_field.cpp | 8 +-
eeschema/sch_field.h | 2 +-
eeschema/sch_item_struct.h | 4 +-
eeschema/sch_junction.cpp | 6 +-
eeschema/sch_junction.h | 2 +-
eeschema/sch_line.cpp | 6 +-
eeschema/sch_line.h | 2 +-
eeschema/sch_marker.cpp | 8 +-
eeschema/sch_marker.h | 2 +-
eeschema/sch_no_connect.cpp | 7 +-
eeschema/sch_no_connect.h | 2 +-
eeschema/sch_screen.cpp | 4 +-
eeschema/sch_sheet.cpp | 14 +-
eeschema/sch_sheet.h | 4 +-
eeschema/sch_sheet_pin.cpp | 2 +-
eeschema/sch_text.cpp | 30 +--
eeschema/sch_text.h | 8 +-
eeschema/schedit.cpp | 4 +-
eeschema/sim/sim_plot_frame.cpp | 2 +-
eeschema/symbdraw.cpp | 8 +-
.../widgets/widget_eeschema_color_config.cpp | 84 +++---
.../widgets/widget_eeschema_color_config.h | 4 +-
gerbview/CMakeLists.txt | 1 +
gerbview/block.cpp | 2 +-
gerbview/class_aperture_macro.cpp | 2 +-
gerbview/class_aperture_macro.h | 2 +-
gerbview/class_gbr_display_options.h | 10 +-
gerbview/class_gbr_layer_box_selector.cpp | 2 +-
gerbview/class_gbr_layer_box_selector.h | 2 +-
gerbview/class_gbr_layout.cpp | 12 +-
gerbview/class_gbr_layout.h | 2 +-
gerbview/class_gerber_draw_item.cpp | 10 +-
gerbview/class_gerber_draw_item.h | 2 +-
gerbview/class_gerber_file_image.h | 4 +-
gerbview/class_gerbview_layer_widget.cpp | 6 +-
gerbview/class_gerbview_layer_widget.h | 4 +-
gerbview/dcode.cpp | 4 +-
gerbview/dcode.h | 7 +-
gerbview/draw_gerber_screen.cpp | 2 +-
gerbview/gerbview_config.cpp | 20 +-
gerbview/gerbview_frame.cpp | 12 +-
gerbview/gerbview_frame.h | 10 +-
gerbview/printout_control.cpp | 2 +-
include/basic_gal.h | 2 +-
include/block_commande.h | 8 +-
include/class_bitmap_base.h | 2 +-
include/class_colors_design_settings.h | 17 +-
include/class_drawpanel.h | 3 +-
include/class_layer_box_selector.h | 5 +-
include/class_marker_base.h | 4 +-
include/class_worksheet_dataitem.h | 42 +--
include/colors.h | 9 +
include/common.h | 4 +-
include/config_params.h | 16 +-
include/draw_frame.h | 22 +-
include/drawtxt.h | 10 +-
include/eda_text.h | 8 +-
include/gal/color4d.h | 80 +++++-
include/gr_basic.h | 102 ++++----
include/msgpanel.h | 19 +-
include/painter.h | 14 -
include/plot_common.h | 28 +-
include/worksheet.h | 6 +-
include/worksheet_shape_builder.h | 34 +--
include/wxPcbStruct.h | 10 +-
include/wxstruct.h | 1 -
kicad/CMakeLists.txt | 1 +
pagelayout_editor/CMakeLists.txt | 1 +
.../dialogs/dialogs_for_printing.cpp | 4 +-
pagelayout_editor/pl_editor_frame.cpp | 2 +-
pcb_calculator/CMakeLists.txt | 1 +
pcbnew/CMakeLists.txt | 1 +
pcbnew/autorouter/auto_place_footprints.cpp | 18 +-
pcbnew/autorouter/autorout.cpp | 16 +-
...board_items_to_polygon_shape_transform.cpp | 2 +-
pcbnew/class_board.cpp | 10 +-
pcbnew/class_board.h | 8 +-
pcbnew/class_dimension.cpp | 2 +-
pcbnew/class_drawsegment.cpp | 4 +-
pcbnew/class_edge_mod.cpp | 4 +-
pcbnew/class_mire.cpp | 2 +-
pcbnew/class_netinfo_item.cpp | 2 +-
pcbnew/class_pad.h | 6 +-
pcbnew/class_pad_draw_functions.cpp | 23 +-
pcbnew/class_pcb_layer_box_selector.cpp | 2 +-
pcbnew/class_pcb_layer_box_selector.h | 2 +-
pcbnew/class_pcb_layer_widget.cpp | 26 +-
pcbnew/class_pcb_layer_widget.h | 5 +-
pcbnew/class_pcb_text.cpp | 6 +-
pcbnew/class_text_mod.cpp | 6 +-
pcbnew/class_track.cpp | 46 ++--
pcbnew/class_track.h | 2 +-
pcbnew/class_zone.cpp | 32 +--
pcbnew/dialogs/dialog_SVG_print.cpp | 2 +-
pcbnew/dialogs/dialog_copper_zones.cpp | 8 +-
.../dialog_keepout_area_properties.cpp | 8 +-
.../dialog_non_copper_zones_properties.cpp | 8 +-
pcbnew/dialogs/dialog_pad_properties.cpp | 4 +-
pcbnew/editrack.cpp | 6 +-
pcbnew/exporters/export_vrml.cpp | 2 +-
pcbnew/exporters/gen_drill_report_files.cpp | 4 +-
pcbnew/layer_widget.cpp | 85 ++++--
pcbnew/layer_widget.h | 25 +-
pcbnew/modedit.cpp | 2 +-
pcbnew/module_editor_frame.h | 2 +-
pcbnew/modview_frame.cpp | 2 +-
pcbnew/modview_frame.h | 2 +-
pcbnew/pcb_painter.cpp | 4 +-
pcbnew/pcb_plot_params.h | 18 +-
pcbnew/pcbframe.cpp | 43 ++-
pcbnew/pcbplot.h | 6 +-
pcbnew/plot_board_layers.cpp | 10 +-
pcbnew/plot_brditems_plotter.cpp | 26 +-
pcbnew/print_board_functions.cpp | 4 +-
pcbnew/printout_controler.cpp | 2 +-
pcbnew/ratsnest.cpp | 2 +-
pcbnew/router/router_preview_item.cpp | 1 -
pcbnew/sel_layer.cpp | 22 +-
pcbnew/swig/pcbnew.i | 4 +-
pcbnew/swig/python_scripting.cpp | 2 +-
pcbnew/tool_pcb.cpp | 14 +-
197 files changed, 1332 insertions(+), 983 deletions(-)
diff --git a/3d-viewer/3d_canvas/cinfo3d_visu.cpp b/3d-viewer/3d_canvas/cinfo3d_visu.cpp
index 353546db46..088f580e06 100644
--- a/3d-viewer/3d_canvas/cinfo3d_visu.cpp
+++ b/3d-viewer/3d_canvas/cinfo3d_visu.cpp
@@ -532,16 +532,9 @@ SFVEC3F CINFO3D_VISU::GetLayerColor( LAYER_ID aLayerId ) const
{
wxASSERT( aLayerId < LAYER_ID_COUNT );
- const EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( aLayerId );
- const StructColors &colordata = g_ColorRefs[ColorGetBase( color )];
+ const COLOR4D color = g_ColorsSettings.GetLayerColor( aLayerId );
- static const float inv_255 = 1.0f / 255.0f;
-
- const float red = colordata.m_Red * inv_255;
- const float green = colordata.m_Green * inv_255;
- const float blue = colordata.m_Blue * inv_255;
-
- return SFVEC3F( red, green, blue );
+ return SFVEC3F( color.r, color.g, color.b );
}
@@ -551,15 +544,7 @@ SFVEC3F CINFO3D_VISU::GetItemColor( int aItemId ) const
}
-SFVEC3F CINFO3D_VISU::GetColor( EDA_COLOR_T aColor ) const
+SFVEC3F CINFO3D_VISU::GetColor( COLOR4D aColor ) const
{
- const StructColors &colordata = g_ColorRefs[ColorGetBase( aColor )];
-
- static const float inv_255 = 1.0f / 255.0f;
-
- const float red = colordata.m_Red * inv_255;
- const float green = colordata.m_Green * inv_255;
- const float blue = colordata.m_Blue * inv_255;
-
- return SFVEC3F( red, green, blue );
+ return SFVEC3F( aColor.r, aColor.g, aColor.b );
}
diff --git a/3d-viewer/3d_canvas/cinfo3d_visu.h b/3d-viewer/3d_canvas/cinfo3d_visu.h
index b50cf3e9b0..90db4387e0 100644
--- a/3d-viewer/3d_canvas/cinfo3d_visu.h
+++ b/3d-viewer/3d_canvas/cinfo3d_visu.h
@@ -270,7 +270,7 @@ class CINFO3D_VISU
* @param aColor: the color mapped
* @return the color in SFVEC3F format
*/
- SFVEC3F GetColor( EDA_COLOR_T aColor ) const;
+ SFVEC3F GetColor( COLOR4D aColor ) const;
/**
* @brief GetLayerTopZpos3DU - Get the top z position
diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp
index 34ab284cc1..361e8f3716 100644
--- a/3d-viewer/3d_canvas/create_layer_items.cpp
+++ b/3d-viewer/3d_canvas/create_layer_items.cpp
@@ -106,7 +106,7 @@ void CINFO3D_VISU::AddShapeWithClearanceToContainer( const TEXTE_PCB* aTextPCB,
s_boardBBox3DU = &m_board2dBBox3DU;
// not actually used, but needed by DrawGraphicText
- const EDA_COLOR_T dummy_color = BLACK;
+ const COLOR4D dummy_color = COLOR4D_BLACK;
if( aTextPCB->IsMultilineAllowed() )
{
diff --git a/3d-viewer/CMakeLists.txt b/3d-viewer/CMakeLists.txt
index cf664c0ffa..096c437b46 100644
--- a/3d-viewer/CMakeLists.txt
+++ b/3d-viewer/CMakeLists.txt
@@ -111,6 +111,11 @@ set(3D-VIEWER_SRCS
add_library(3d-viewer STATIC ${3D-VIEWER_SRCS})
add_dependencies( 3d-viewer pcbcommon )
-target_link_libraries( 3d-viewer ${Boost_} ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} kicad_3dsg )
+target_link_libraries( 3d-viewer
+ gal
+ ${Boost_}
+ ${wxWidgets_LIBRARIES}
+ ${OPENGL_LIBRARIES}
+ kicad_3dsg )
add_subdirectory( 3d_cache )
diff --git a/bitmap2component/CMakeLists.txt b/bitmap2component/CMakeLists.txt
index b1d2720b37..76d399008a 100644
--- a/bitmap2component/CMakeLists.txt
+++ b/bitmap2component/CMakeLists.txt
@@ -47,6 +47,7 @@ target_link_libraries( bitmap2component
common
polygon
bitmaps
+ gal
${wxWidgets_LIBRARIES}
potrace
)
diff --git a/common/block_commande.cpp b/common/block_commande.cpp
index e313eb43f5..00a77af7e9 100644
--- a/common/block_commande.cpp
+++ b/common/block_commande.cpp
@@ -122,7 +122,7 @@ void BLOCK_SELECTOR::SetMessageBlock( EDA_DRAW_FRAME* frame )
void BLOCK_SELECTOR::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
+ GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
if( !aDC )
return;
diff --git a/common/class_bitmap_base.cpp b/common/class_bitmap_base.cpp
index 5cf46b4b10..892a5608f8 100644
--- a/common/class_bitmap_base.cpp
+++ b/common/class_bitmap_base.cpp
@@ -287,7 +287,7 @@ void BITMAP_BASE::Rotate( bool aRotateCCW )
void BITMAP_BASE::PlotImage( PLOTTER* aPlotter,
const wxPoint& aPos,
- EDA_COLOR_T aDefaultColor,
+ COLOR4D aDefaultColor,
int aDefaultPensize )
{
if( m_image == NULL )
diff --git a/common/class_colors_design_settings.cpp b/common/class_colors_design_settings.cpp
index dbdd6ac6b5..8b72a32df3 100644
--- a/common/class_colors_design_settings.cpp
+++ b/common/class_colors_design_settings.cpp
@@ -27,7 +27,6 @@
* @brief Handle colors used to draw all items or layers.
*/
#include
-#include
#include
#include
@@ -91,7 +90,7 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
{
for( unsigned src = 0, dst = 0; dst < DIM(m_LayersColors); ++dst )
{
- m_LayersColors[dst] = default_layer_color[src++];
+ m_LayersColors[dst] = COLOR4D( default_layer_color[src++] );
if( src >= DIM( default_layer_color ) )
src = 0; // wrap the source.
@@ -99,7 +98,7 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
for( unsigned src = 0, dst = 0; dst < DIM(m_ItemsColors); ++dst )
{
- m_ItemsColors[dst] = default_items_color[src++];
+ m_ItemsColors[dst] = COLOR4D( default_items_color[src++] );
if( src >= DIM( default_items_color ) )
src = 0;
@@ -107,17 +106,17 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS()
}
-EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
+COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
{
if( (unsigned) aLayer < DIM(m_LayersColors) )
{
return m_LayersColors[aLayer];
}
- return UNSPECIFIED_COLOR;
+ return UNSPECIFIED_COLOR4D;
}
-void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
+void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
{
if( (unsigned) aLayer < DIM(m_LayersColors) )
{
@@ -126,18 +125,18 @@ void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor
}
-EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
+COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
{
if( (unsigned) aItemIdx < DIM( m_ItemsColors ) )
{
return m_ItemsColors[aItemIdx];
}
- return UNSPECIFIED_COLOR;
+ return UNSPECIFIED_COLOR4D;
}
-void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, EDA_COLOR_T aColor )
+void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, COLOR4D aColor )
{
if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
{
@@ -146,7 +145,7 @@ void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, EDA_COLOR_T aColor )
}
-void COLORS_DESIGN_SETTINGS::SetAllColorsAs( EDA_COLOR_T aColor )
+void COLORS_DESIGN_SETTINGS::SetAllColorsAs( COLOR4D aColor )
{
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
m_LayersColors[ii] = aColor;
diff --git a/common/class_layer_box_selector.cpp b/common/class_layer_box_selector.cpp
index ad2df99f5c..3a8d4b7351 100644
--- a/common/class_layer_box_selector.cpp
+++ b/common/class_layer_box_selector.cpp
@@ -26,7 +26,6 @@
#include
#include
#include
-#include
#include
#include
@@ -56,7 +55,7 @@ void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
// Prepare Bitmap
bmpDC.SelectObject( aLayerbmp );
- brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) );
+ brush.SetColour( GetLayerColor( aLayer ).ToColour() );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
bmpDC.SetBrush( brush );
diff --git a/common/common.cpp b/common/common.cpp
index 976e419d18..7e5f90f090 100644
--- a/common/common.cpp
+++ b/common/common.cpp
@@ -42,6 +42,8 @@
#include
+using KIGFX::COLOR4D;
+
/**
* Global variables definitions.
@@ -53,7 +55,7 @@
bool g_ShowPageLimits = true;
EDA_UNITS_T g_UserUnit;
-EDA_COLOR_T g_GhostColor;
+COLOR4D g_GhostColor;
/* Class LOCALE_IO
diff --git a/common/common_plotDXF_functions.cpp b/common/common_plotDXF_functions.cpp
index 84917a81a4..e6be16fb34 100644
--- a/common/common_plotDXF_functions.cpp
+++ b/common/common_plotDXF_functions.cpp
@@ -25,6 +25,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
#include
#include
#include
@@ -68,7 +69,7 @@ void DXF_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
SetDefaultLineWidth( 0 ); // No line width on DXF
m_plotMirror = false; // No mirroring on DXF
- m_currentColor = BLACK;
+ m_currentColor = COLOR4D_BLACK;
}
/**
@@ -275,17 +276,17 @@ bool DXF_PLOTTER::EndPlot()
/**
* The DXF exporter handles 'colors' as layers...
*/
-void DXF_PLOTTER::SetColor( EDA_COLOR_T color )
+void DXF_PLOTTER::SetColor( COLOR4D color )
{
wxASSERT( outputFile );
- if( ( color >= 0 && colorMode )
- || ( color == BLACK )
- || ( color == WHITE ) )
+ if( ( colorMode )
+ || ( color == COLOR4D_BLACK )
+ || ( color == COLOR4D_WHITE ) )
{
m_currentColor = color;
}
else
- m_currentColor = BLACK;
+ m_currentColor = COLOR4D_BLACK;
}
/**
@@ -315,14 +316,16 @@ void DXF_PLOTTER::Circle( const wxPoint& centre, int diameter, FILL_T fill, int
DPOINT centre_dev = userToDeviceCoordinates( centre );
if( radius > 0 )
{
- wxString cname( ColorGetName( m_currentColor ) );
- if (!fill)
+ wxString cname( m_currentColor.ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
+
+ if( !fill )
{
fprintf( outputFile, "0\nCIRCLE\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n",
TO_UTF8( cname ),
centre_dev.x, centre_dev.y, radius );
}
- if (fill == FILLED_SHAPE)
+
+ if( fill == FILLED_SHAPE )
{
double r = radius*0.5;
fprintf( outputFile, "0\nPOLYLINE\n");
@@ -462,7 +465,7 @@ void DXF_PLOTTER::PenTo( const wxPoint& pos, char plume )
if( penLastpos != pos && plume == 'D' )
{
// DXF LINE
- wxString cname( ColorGetName( m_currentColor ) );
+ wxString cname( m_currentColor.ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
fprintf( outputFile, "0\nLINE\n8\n%s\n10\n%g\n20\n%g\n11\n%g\n21\n%g\n",
TO_UTF8( cname ),
pen_lastpos_dev.x, pen_lastpos_dev.y, pos_dev.x, pos_dev.y );
@@ -509,7 +512,7 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
double radius_dev = userToDeviceSize( radius );
// Emit a DXF ARC entity
- wxString cname( ColorGetName( m_currentColor ) );
+ wxString cname( m_currentColor.ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
fprintf( outputFile,
"0\nARC\n8\n%s\n10\n%g\n20\n%g\n40\n%g\n50\n%g\n51\n%g\n",
TO_UTF8( cname ),
@@ -699,7 +702,7 @@ bool containsNonAsciiChars( const wxString& string )
}
void DXF_PLOTTER::Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
@@ -729,7 +732,7 @@ void DXF_PLOTTER::Text( const wxPoint& aPos,
more useful as a CAD object */
DPOINT origin_dev = userToDeviceCoordinates( aPos );
SetColor( aColor );
- wxString cname( ColorGetName( m_currentColor ) );
+ wxString cname( m_currentColor.ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
DPOINT size_dev = userToDeviceSize( aSize );
int h_code = 0, v_code = 0;
switch( aH_justify )
diff --git a/common/common_plotGERBER_functions.cpp b/common/common_plotGERBER_functions.cpp
index ecdb57eb99..22ab552c8e 100644
--- a/common/common_plotGERBER_functions.cpp
+++ b/common/common_plotGERBER_functions.cpp
@@ -938,7 +938,7 @@ void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCo
}
-void GERBER_PLOTTER::Text( const wxPoint& aPos, enum EDA_COLOR_T aColor,
+void GERBER_PLOTTER::Text( const wxPoint& aPos, const COLOR4D aColor,
const wxString& aText, double aOrient, const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth, bool aItalic, bool aBold, bool aMultilineAllowed,
diff --git a/common/common_plotPDF_functions.cpp b/common/common_plotPDF_functions.cpp
index 2a7d7e6667..4dd20bb333 100644
--- a/common/common_plotPDF_functions.cpp
+++ b/common/common_plotPDF_functions.cpp
@@ -755,7 +755,7 @@ bool PDF_PLOTTER::EndPlot()
}
void PDF_PLOTTER::Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
diff --git a/common/common_plotPS_functions.cpp b/common/common_plotPS_functions.cpp
index 4a245511b6..316b1954ca 100644
--- a/common/common_plotPS_functions.cpp
+++ b/common/common_plotPS_functions.cpp
@@ -56,21 +56,14 @@ void PSLIKE_PLOTTER::SetDefaultLineWidth( int width )
}
-void PSLIKE_PLOTTER::SetColor( EDA_COLOR_T color )
+void PSLIKE_PLOTTER::SetColor( COLOR4D color )
{
- // Return at invalid color index
- if( color < 0 )
- return;
-
if( colorMode )
{
- double r = g_ColorRefs[color].m_Red / 255.0;
- double g = g_ColorRefs[color].m_Green / 255.0;
- double b = g_ColorRefs[color].m_Blue / 255.0;
if( negativeMode )
- emitSetRGBColor( 1 - r, 1 - g, 1 - b );
+ emitSetRGBColor( 1 - color.r, 1 - color.g, 1 - color.b );
else
- emitSetRGBColor( r, g, b );
+ emitSetRGBColor( color.r, color.g, color.b );
}
else
{
@@ -79,7 +72,7 @@ void PSLIKE_PLOTTER::SetColor( EDA_COLOR_T color )
* holes in white on pads in black
*/
double k = 1; // White
- if( color != WHITE )
+ if( color != COLOR4D_WHITE )
k = 0;
if( negativeMode )
emitSetRGBColor( 1 - k, 1 - k, 1 - k );
@@ -927,7 +920,7 @@ bool PS_PLOTTER::EndPlot()
void PS_PLOTTER::Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
diff --git a/common/common_plotSVG_functions.cpp b/common/common_plotSVG_functions.cpp
index 5c0973bc19..4a0820a33f 100644
--- a/common/common_plotSVG_functions.cpp
+++ b/common/common_plotSVG_functions.cpp
@@ -187,7 +187,7 @@ void SVG_PLOTTER::SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
}
-void SVG_PLOTTER::SetColor( EDA_COLOR_T color )
+void SVG_PLOTTER::SetColor( COLOR4D color )
{
PSLIKE_PLOTTER::SetColor( color );
@@ -602,7 +602,7 @@ bool SVG_PLOTTER::EndPlot()
void SVG_PLOTTER::Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
diff --git a/common/common_plot_functions.cpp b/common/common_plot_functions.cpp
index 815479670a..2a171bde89 100644
--- a/common/common_plot_functions.cpp
+++ b/common/common_plot_functions.cpp
@@ -79,7 +79,7 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
*/
double iusPerMil = plotter->GetIUsPerDecimil() * 10.0;
- EDA_COLOR_T plotColor = plotter->GetColorMode() ? RED : BLACK;
+ COLOR4D plotColor = plotter->GetColorMode() ? COLOR4D( RED ) : COLOR4D_BLACK;
plotter->SetColor( plotColor );
WS_DRAW_ITEM_LIST drawList;
diff --git a/common/config_params.cpp b/common/config_params.cpp
index 9737e8ec2c..9f91d743e7 100644
--- a/common/config_params.cpp
+++ b/common/config_params.cpp
@@ -243,8 +243,8 @@ void PARAM_CFG_INT_WITH_SCALE::SaveParam( wxConfigBase* aConfig ) const
}
-PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxString& ident, EDA_COLOR_T* ptparam,
- EDA_COLOR_T default_val,
+PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxString& ident, COLOR4D* ptparam,
+ COLOR4D default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
{
@@ -255,8 +255,8 @@ PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( const wxString& ident, EDA_COLOR_T* ptpa
PARAM_CFG_SETCOLOR::PARAM_CFG_SETCOLOR( bool Insetup,
const wxString& ident,
- EDA_COLOR_T* ptparam,
- EDA_COLOR_T default_val,
+ COLOR4D* ptparam,
+ COLOR4D default_val,
const wxChar* group ) :
PARAM_CFG_BASE( ident, PARAM_SETCOLOR, group )
{
@@ -271,11 +271,22 @@ void PARAM_CFG_SETCOLOR::ReadParam( wxConfigBase* aConfig ) const
if( !m_Pt_param || !aConfig )
return;
- EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT("NONE") ) );
+ // First try reading old format
+ EDA_COLOR_T itmp = ColorByName( aConfig->Read( m_Ident, wxT( "NONE" ) ) );
+ COLOR4D wtmp = UNSPECIFIED_COLOR4D;
if( itmp == UNSPECIFIED_COLOR )
- itmp = m_Default;
- *m_Pt_param = itmp;
+ {
+ // Next try reading new format
+ if( !wtmp.SetFromWxString( aConfig->Read( m_Ident, wxT( "NONE" ) ) ) )
+ wtmp = m_Default;
+ }
+ else
+ {
+ wtmp = COLOR4D( itmp );
+ }
+
+ *m_Pt_param = wtmp;
}
@@ -284,7 +295,7 @@ void PARAM_CFG_SETCOLOR::SaveParam( wxConfigBase* aConfig ) const
if( !m_Pt_param || !aConfig )
return;
- aConfig->Write( m_Ident, ColorGetName( *m_Pt_param ) );
+ aConfig->Write( m_Ident, m_Pt_param->ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
}
diff --git a/common/draw_frame.cpp b/common/draw_frame.cpp
index d80efa3ae4..fb0b6ce8de 100644
--- a/common/draw_frame.cpp
+++ b/common/draw_frame.cpp
@@ -157,10 +157,10 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_cursorShape = 0;
m_LastGridSizeId = 0;
m_drawGrid = true; // hide/Show grid. default = show
- m_gridColor = DARKGRAY; // Default grid color
+ m_gridColor = COLOR4D( DARKGRAY ); // Default grid color
m_showPageLimits = false;
- m_drawBgColor = BLACK; // the background color of the draw canvas:
- // BLACK for Pcbnew, BLACK or WHITE for eeschema
+ m_drawBgColor = COLOR4D( BLACK ); // the background color of the draw canvas:
+ // BLACK for Pcbnew, BLACK or WHITE for eeschema
m_snapToGrid = true;
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
m_movingCursorWithKeyboard = false;
@@ -210,7 +210,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_messagePanel = new EDA_MSG_PANEL( this, -1, wxPoint( 0, m_FrameSize.y ),
wxSize( m_FrameSize.x, m_MsgFrameHeight ) );
- m_messagePanel->SetBackgroundColour( MakeColour( LIGHTGRAY ) );
+ m_messagePanel->SetBackgroundColour( COLOR4D( LIGHTGRAY ).ToColour() );
}
@@ -728,7 +728,8 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
aCfg->Write( baseCfgName + CursorShapeEntryKeyword, m_cursorShape );
aCfg->Write( baseCfgName + ShowGridEntryKeyword, IsGridVisible() );
- aCfg->Write( baseCfgName + GridColorEntryKeyword, ( long ) GetGridColor() );
+ aCfg->Write( baseCfgName + GridColorEntryKeyword,
+ GetGridColor().ToColour().GetAsString( wxC2S_CSS_SYNTAX ) );
aCfg->Write( baseCfgName + LastGridSizeIdKeyword, ( long ) m_LastGridSizeId );
if( GetScreen() )
@@ -740,7 +741,7 @@ void EDA_DRAW_FRAME::SaveSettings( wxConfigBase* aCfg )
void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper,
const wxString& textLower,
- EDA_COLOR_T color, int pad )
+ COLOR4D color, int pad )
{
if( m_messagePanel == NULL )
return;
diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp
index d32446406b..4d91fa4a32 100644
--- a/common/draw_panel.cpp
+++ b/common/draw_panel.cpp
@@ -109,7 +109,7 @@ EDA_DRAW_PANEL::EDA_DRAW_PANEL( EDA_DRAW_FRAME* parent, int id,
SetLayoutDirection( wxLayout_LeftToRight );
- SetBackgroundColour( MakeColour( parent->GetDrawBgColor() ) );
+ SetBackgroundColour( parent->GetDrawBgColor().ToColour() );
#if KICAD_USE_BUFFERED_DC || KICAD_USE_BUFFERED_PAINTDC
SetBackgroundStyle( wxBG_STYLE_CUSTOM );
@@ -212,7 +212,7 @@ wxPoint EDA_DRAW_PANEL::ToLogicalXY( const wxPoint& pos )
}
-void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor )
+void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, COLOR4D aColor )
{
if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )
return;
@@ -554,7 +554,7 @@ void EDA_DRAW_PANEL::EraseScreen( wxDC* DC )
{
GRSetDrawMode( DC, GR_COPY );
- EDA_COLOR_T bgColor = GetParent()->GetDrawBgColor();
+ COLOR4D bgColor = GetParent()->GetDrawBgColor();
GRSFilledRect( NULL, DC, m_ClipBox.GetX(), m_ClipBox.GetY(),
m_ClipBox.GetRight(), m_ClipBox.GetBottom(),
@@ -611,12 +611,10 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
if( Screen == NULL )
return;
- EDA_COLOR_T bgColor = GetParent()->GetDrawBgColor();
+ COLOR4D bgColor = GetParent()->GetDrawBgColor();
- if( ( bgColor != WHITE ) && ( bgColor != BLACK ) )
- bgColor = BLACK;
-
- if( bgColor == WHITE )
+ // TODO(JE): Is this correct?
+ if( bgColor.GetBrightness() > 0.5 )
{
g_XorMode = GR_NXOR;
g_GhostColor = BLACK;
@@ -629,7 +627,7 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )
GRResetPenAndBrush( DC );
- DC->SetBackground( bgColor == BLACK ? *wxBLACK_BRUSH : *wxWHITE_BRUSH );
+ DC->SetBackground( wxBrush( bgColor.ToColour() ) );
DC->SetBackgroundMode( wxSOLID );
if( erasebg )
@@ -666,7 +664,7 @@ void EDA_DRAW_PANEL::SetEnableZoomNoCenter( bool aEnable )
void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
{
- EDA_COLOR_T axis_color = BLUE;
+ COLOR4D axis_color = COLOR4D( BLUE );
GRSetDrawMode( DC, GR_COPY );
@@ -756,7 +754,7 @@ void EDA_DRAW_PANEL::DrawGrid( wxDC* aDC )
const double h = aDC->DeviceToLogicalYRel( gsz );
// Use our own pen
- wxPen pen( MakeColour( GetParent()->GetGridColor() ), h );
+ wxPen pen( GetParent()->GetGridColor(), h );
pen.SetCap( wxCAP_BUTT );
gc->SetPen( pen );
@@ -801,7 +799,7 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
if( origin == wxPoint( 0, 0 ) )
return;
- EDA_COLOR_T color = RED;
+ COLOR4D color = COLOR4D( RED );
GRSetDrawMode( aDC, aDrawMode );
@@ -837,7 +835,7 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode, const wxPoi
if( !GetParent()->m_showGridAxis || ( !aGridOrigin.x && !aGridOrigin.y ) )
return;
- EDA_COLOR_T color = GetParent()->GetGridColor();
+ COLOR4D color = GetParent()->GetGridColor();
GRSetDrawMode( aDC, aDrawMode );
diff --git a/common/drawtxt.cpp b/common/drawtxt.cpp
index 85ca77681b..ff5e012eea 100644
--- a/common/drawtxt.cpp
+++ b/common/drawtxt.cpp
@@ -103,7 +103,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
* @param aClipBox = the clipping rect, or NULL if no clipping
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
* @param aPos = text position (according to h_justify, v_justify)
- * @param aColor (enum EDA_COLOR_T) = text color
+ * @param aColor (COLOR4D) = text color
* @param aText = text to draw
* @param aOrient = angle in 0.1 degree
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
@@ -122,7 +122,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool aItalic,
void DrawGraphicText( EDA_RECT* aClipBox,
wxDC* aDC,
const wxPoint& aPos,
- EDA_COLOR_T aColor,
+ COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
@@ -175,9 +175,9 @@ void DrawGraphicText( EDA_RECT* aClipBox,
void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
const wxPoint &aPos,
- enum EDA_COLOR_T aBgColor,
- enum EDA_COLOR_T aColor1,
- enum EDA_COLOR_T aColor2,
+ const COLOR4D aBgColor,
+ COLOR4D aColor1,
+ COLOR4D aColor2,
const wxString &aText,
double aOrient,
const wxSize &aSize,
@@ -188,9 +188,10 @@ void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
PLOTTER * aPlotter )
{
// Swap color if contrast would be better
- if( ColorIsLight( aBgColor ) )
+ // TODO: Maybe calculate contrast some way other than brightness
+ if( aBgColor.GetBrightness() > 0.5 )
{
- EDA_COLOR_T c = aColor1;
+ COLOR4D c = aColor1;
aColor1 = aColor2;
aColor2 = c;
}
@@ -210,7 +211,7 @@ void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
* Function PLOTTER::Text
* same as DrawGraphicText, but plot graphic text insteed of draw it
* @param aPos = text position (according to aH_justify, aV_justify)
- * @param aColor (enum EDA_COLOR_T) = text color
+ * @param aColor (COLOR4D) = text color
* @param aText = text to draw
* @param aOrient = angle in 0.1 degree
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
@@ -224,7 +225,7 @@ void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
* @param aMultilineAllowed = true to plot text as multiline, otherwise single line
*/
void PLOTTER::Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
@@ -248,8 +249,7 @@ void PLOTTER::Text( const wxPoint& aPos,
SetCurrentLineWidth( textPensize, aData );
- if( aColor >= 0 )
- SetColor( aColor );
+ SetColor( aColor );
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
aOrient, aSize,
diff --git a/common/eda_text.cpp b/common/eda_text.cpp
index 02fc24b100..874fc74f4d 100644
--- a/common/eda_text.cpp
+++ b/common/eda_text.cpp
@@ -289,8 +289,8 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
- EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode,
- EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color )
+ COLOR4D aColor, GR_DRAWMODE aDrawMode,
+ EDA_DRAW_MODE_T aFillMode, COLOR4D aAnchor_color )
{
if( IsMultilineAllowed() )
{
@@ -314,7 +314,7 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
aDrawMode, aFillMode, GetShownText(), GetTextPos() );
// Draw text anchor, if requested
- if( aAnchor_color != UNSPECIFIED_COLOR )
+ if( aAnchor_color != UNSPECIFIED_COLOR4D )
{
GRDrawAnchor( aClipBox, aDC,
GetTextPos().x + aOffset.x, GetTextPos().y + aOffset.y,
@@ -366,7 +366,7 @@ void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
}
void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
- const wxPoint& aOffset, EDA_COLOR_T aColor,
+ const wxPoint& aOffset, COLOR4D aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
const wxString& aText, const wxPoint &aPos )
{
@@ -511,7 +511,7 @@ void EDA_TEXT::TransformTextShapeToSegmentList( std::vector& aCornerBuf
size.x = -size.x;
s_cornerBuffer = &aCornerBuffer;
- EDA_COLOR_T color = BLACK; // not actually used, but needed by DrawGraphicText
+ COLOR4D color = COLOR4D_BLACK; // not actually used, but needed by DrawGraphicText
if( IsMultilineAllowed() )
{
diff --git a/common/gal/color4d.cpp b/common/gal/color4d.cpp
index 3b509d3317..0ea4f3a1e6 100644
--- a/common/gal/color4d.cpp
+++ b/common/gal/color4d.cpp
@@ -24,6 +24,8 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
+ COLOR4D aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform ) override;
/**
@@ -191,7 +191,7 @@ public:
*/
wxString GetFullText( int unit = 1 ) const;
- EDA_COLOR_T GetDefaultColor() override;
+ COLOR4D GetDefaultColor() override;
void BeginEdit( STATUS_FLAGS aEditMode, const wxPoint aStartPoint = wxPoint( 0, 0 ) ) override;
diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp
index ff13462b21..03171b1d34 100644
--- a/eeschema/lib_pin.cpp
+++ b/eeschema/lib_pin.cpp
@@ -905,7 +905,7 @@ int LIB_PIN::GetPenSize() const
void LIB_PIN::drawGraphic( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
- EDA_COLOR_T aColor,
+ COLOR4D aColor,
GR_DRAWMODE aDrawMode,
void* aData,
const TRANSFORM& aTransform )
@@ -982,7 +982,7 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
const wxPoint& aPinPos,
int aOrient,
GR_DRAWMODE aDrawMode,
- EDA_COLOR_T aColor,
+ COLOR4D aColor,
bool aDrawDangling,
bool aOnlyTarget )
{
@@ -991,9 +991,9 @@ void LIB_PIN::DrawPinSymbol( EDA_DRAW_PANEL* aPanel,
int posX = aPinPos.x, posY = aPinPos.y, len = m_length;
EDA_RECT* clipbox = aPanel ? aPanel->GetClipBox() : NULL;
- EDA_COLOR_T color = GetLayerColor( LAYER_PIN );
+ COLOR4D color = GetLayerColor( LAYER_PIN );
- if( aColor < 0 ) // Used normal color or selected color
+ if( aColor == UNSPECIFIED_COLOR4D ) // Used normal color or selected color
{
if( IsSelected() )
color = GetItemSelectedColor();
@@ -1183,7 +1183,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
int TextInside,
bool DrawPinNum,
bool DrawPinName,
- EDA_COLOR_T Color,
+ COLOR4D Color,
GR_DRAWMODE DrawMode )
{
if( !DrawPinName && !DrawPinNum )
@@ -1210,13 +1210,13 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
/* Get the num and name colors */
- if( (Color < 0) && IsSelected() )
+ if( ( Color == UNSPECIFIED_COLOR4D ) && IsSelected() )
Color = GetItemSelectedColor();
- EDA_COLOR_T NameColor = Color == UNSPECIFIED_COLOR ?
- GetLayerColor( LAYER_PINNAM ) : Color;
- EDA_COLOR_T NumColor = Color == UNSPECIFIED_COLOR ?
- GetLayerColor( LAYER_PINNUM ) : Color;
+ COLOR4D NameColor = Color == UNSPECIFIED_COLOR4D ?
+ GetLayerColor( LAYER_PINNAM ) : Color;
+ COLOR4D NumColor = Color == UNSPECIFIED_COLOR4D ?
+ GetLayerColor( LAYER_PINNUM ) : Color;
/* Create the pin num string */
PinStringNum( StringPinNum );
@@ -1396,7 +1396,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
void LIB_PIN::DrawPinElectricalTypeName( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
wxPoint& aPosition, int aOrientation,
- EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode )
+ COLOR4D aColor, GR_DRAWMODE aDrawMode )
{
wxString etypeName = GetElectricalTypeName();
@@ -1411,7 +1411,7 @@ void LIB_PIN::DrawPinElectricalTypeName( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
int pensize = etextSize/6;
// Get a suitable color
- if( (aColor < 0) && IsSelected() )
+ if( ( aColor == UNSPECIFIED_COLOR4D ) && IsSelected() )
aColor = GetItemSelectedColor();
else if( !IsVisible() )
aColor = GetInvisibleItemColor();
@@ -1459,7 +1459,7 @@ void LIB_PIN::DrawPinElectricalTypeName( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
void LIB_PIN::PlotSymbol( PLOTTER* aPlotter, const wxPoint& aPosition, int aOrientation )
{
int MapX1, MapY1, x1, y1;
- EDA_COLOR_T color = GetLayerColor( LAYER_PIN );
+ COLOR4D color = GetLayerColor( LAYER_PIN );
aPlotter->SetColor( color );
aPlotter->SetCurrentLineWidth( GetPenSize() );
@@ -1639,8 +1639,8 @@ void LIB_PIN::PlotPinTexts( PLOTTER* plotter, wxPoint& pin_pos, int orient,
( numLineWidth + GetDefaultLineThickness() ) / 2;
/* Get the num and name colors */
- EDA_COLOR_T NameColor = GetLayerColor( LAYER_PINNAM );
- EDA_COLOR_T NumColor = GetLayerColor( LAYER_PINNUM );
+ COLOR4D NameColor = GetLayerColor( LAYER_PINNAM );
+ COLOR4D NumColor = GetLayerColor( LAYER_PINNUM );
int x1 = pin_pos.x;
int y1 = pin_pos.y;
diff --git a/eeschema/lib_pin.h b/eeschema/lib_pin.h
index f7fba3a93e..4f871e047c 100644
--- a/eeschema/lib_pin.h
+++ b/eeschema/lib_pin.h
@@ -85,7 +85,7 @@ class LIB_PIN : public LIB_ITEM
* @param aPanel DrawPanel to use (can be null) mainly used for clipping purposes.
* @param aDC Device Context (can be null)
* @param aOffset Offset to draw
- * @param aColor -1 to use the normal body item color, or use this color if >= 0
+ * @param aColor UNSPECIFIED_COLOR4D to use the normal body item color, or else use this color
* @param aDrawMode GR_OR, GR_XOR, ...
* @param aData = used here as uintptr_t containing bitwise OR'd flags:
* PIN_DRAW_TEXTS, -- false to draw only pin shape, useful for fast mode
@@ -95,7 +95,7 @@ class LIB_PIN : public LIB_ITEM
* @param aTransform Transform Matrix (rotation, mirror ..)
*/
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
+ COLOR4D aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform ) override;
public:
@@ -385,7 +385,7 @@ public:
*/
void DrawPinSymbol( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
int aOrientation, GR_DRAWMODE aDrawMode,
- EDA_COLOR_T aColor = UNSPECIFIED_COLOR,
+ COLOR4D aColor = UNSPECIFIED_COLOR4D,
bool aDrawDangling = true,
bool aOnlyTarget = false );
@@ -401,7 +401,7 @@ public:
*/
void DrawPinTexts( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint& aPosition,
int aOrientation, int TextInside, bool DrawPinNum, bool DrawPinName,
- EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode );
+ COLOR4D aColor, GR_DRAWMODE aDrawMode );
/**
* Function DrawPinElectricalTypeName
@@ -409,7 +409,7 @@ public:
* aDrawMode = GR_OR, XOR ...
*/
void DrawPinElectricalTypeName( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint& aPosition,
- int aOrientation, EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode );
+ int aOrientation, COLOR4D aColor, GR_DRAWMODE aDrawMode );
/**
* Function PlotPinTexts
diff --git a/eeschema/lib_polyline.cpp b/eeschema/lib_polyline.cpp
index 3392e72278..78a3fe9b60 100644
--- a/eeschema/lib_polyline.cpp
+++ b/eeschema/lib_polyline.cpp
@@ -263,14 +263,14 @@ int LIB_POLYLINE::GetPenSize() const
void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
+ COLOR4D aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{
wxPoint pos1;
- EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE );
+ COLOR4D color = GetLayerColor( LAYER_DEVICE );
wxPoint* buffer = NULL;
- if( aColor < 0 ) // Used normal color or selected color
+ if( aColor == UNSPECIFIED_COLOR4D ) // Used normal color or selected color
{
if( IsSelected() )
color = GetItemSelectedColor();
@@ -289,7 +289,7 @@ void LIB_POLYLINE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint
FILL_T fill = aData ? NO_FILL : m_Fill;
- if( aColor >= 0 )
+ if( aColor != UNSPECIFIED_COLOR4D )
fill = NO_FILL;
GRSetDrawMode( aDC, aDrawMode );
diff --git a/eeschema/lib_polyline.h b/eeschema/lib_polyline.h
index 96f70c6644..167db0d660 100644
--- a/eeschema/lib_polyline.h
+++ b/eeschema/lib_polyline.h
@@ -40,7 +40,7 @@ class LIB_POLYLINE : public LIB_ITEM
int m_ModifyIndex; // Index of the polyline point to modify
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
+ COLOR4D aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform ) override;
void calcEdit( const wxPoint& aPosition ) override;
diff --git a/eeschema/lib_rectangle.cpp b/eeschema/lib_rectangle.cpp
index 7f17d05de3..6568bbb53f 100644
--- a/eeschema/lib_rectangle.cpp
+++ b/eeschema/lib_rectangle.cpp
@@ -196,14 +196,14 @@ int LIB_RECTANGLE::GetPenSize() const
void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
- const wxPoint& aOffset, EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode,
+ const wxPoint& aOffset, COLOR4D aColor, GR_DRAWMODE aDrawMode,
void* aData, const TRANSFORM& aTransform )
{
wxPoint pos1, pos2;
- EDA_COLOR_T color = GetLayerColor( LAYER_DEVICE );
+ COLOR4D color = GetLayerColor( LAYER_DEVICE );
- if( aColor < 0 ) // Used normal color or selected color
+ if( aColor == UNSPECIFIED_COLOR4D ) // Used normal color or selected color
{
if( IsSelected() )
color = GetItemSelectedColor();
@@ -218,7 +218,7 @@ void LIB_RECTANGLE::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
FILL_T fill = aData ? NO_FILL : m_Fill;
- if( aColor >= 0 )
+ if( aColor != UNSPECIFIED_COLOR4D )
fill = NO_FILL;
GRSetDrawMode( aDC, aDrawMode );
diff --git a/eeschema/lib_rectangle.h b/eeschema/lib_rectangle.h
index b7ecd2b155..6391b5f004 100644
--- a/eeschema/lib_rectangle.h
+++ b/eeschema/lib_rectangle.h
@@ -42,7 +42,7 @@ class LIB_RECTANGLE : public LIB_ITEM
bool m_isStartPointSelected; // Flag: is the upper left edge selected?
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
+ COLOR4D aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform ) override;
void calcEdit( const wxPoint& aPosition ) override;
diff --git a/eeschema/lib_text.cpp b/eeschema/lib_text.cpp
index d2e8b00f93..7d237fa173 100644
--- a/eeschema/lib_text.cpp
+++ b/eeschema/lib_text.cpp
@@ -334,12 +334,12 @@ void LIB_TEXT::Plot( PLOTTER* plotter, const wxPoint& offset, bool fill,
wxPoint pos = aTransform.TransformCoordinate( txtpos ) + offset;
// Get color
- EDA_COLOR_T color;
+ COLOR4D color;
if( plotter->GetColorMode() ) // Used normal color or selected color
color = IsSelected() ? GetItemSelectedColor() : GetDefaultColor();
else
- color = BLACK;
+ color = COLOR4D_BLACK;
plotter->Text( pos, color, GetShownText(),
t1 ? TEXT_ANGLE_HORIZ : TEXT_ANGLE_VERT,
@@ -367,12 +367,12 @@ int LIB_TEXT::GetPenSize() const
void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
+ COLOR4D aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform )
{
- EDA_COLOR_T color = GetDefaultColor();
+ COLOR4D color = GetDefaultColor();
- if( aColor < 0 ) // Used normal color or selected color
+ if( aColor == UNSPECIFIED_COLOR4D ) // Used normal color or selected color
{
if( IsSelected() )
color = GetItemSelectedColor();
diff --git a/eeschema/lib_text.h b/eeschema/lib_text.h
index f48bc08e94..3ab8c6b5da 100644
--- a/eeschema/lib_text.h
+++ b/eeschema/lib_text.h
@@ -49,7 +49,7 @@ class LIB_TEXT : public LIB_ITEM, public EDA_TEXT
bool m_updateText; ///< Flag to indicate text change occurred while editing.
void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode, void* aData,
+ COLOR4D aColor, GR_DRAWMODE aDrawMode, void* aData,
const TRANSFORM& aTransform ) override;
void calcEdit( const wxPoint& aPosition ) override;
diff --git a/eeschema/libeditframe.cpp b/eeschema/libeditframe.cpp
index f3aa1ae5fd..da8aeb36a6 100644
--- a/eeschema/libeditframe.cpp
+++ b/eeschema/libeditframe.cpp
@@ -801,10 +801,10 @@ void LIB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_canvas->MoveCursorToCrossHair();
STATUS_FLAGS oldFlags = m_drawItem->GetFlags();
m_drawItem->ClearFlags();
- m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL,
+ m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, g_XorMode, NULL,
DefaultTransform );
( (LIB_POLYLINE*) m_drawItem )->DeleteSegment( GetCrossHairPosition( true ) );
- m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL,
+ m_drawItem->Draw( m_canvas, &dc, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, g_XorMode, NULL,
DefaultTransform );
m_drawItem->SetFlags( oldFlags );
m_lastDrawItem = NULL;
@@ -1048,7 +1048,7 @@ void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem )
// Deleting old text
if( DC && !DrawItem->InEditMode() )
- DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode, NULL,
+ DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, g_XorMode, NULL,
DefaultTransform );
DIALOG_LIB_EDIT_TEXT* frame = new DIALOG_LIB_EDIT_TEXT( this, (LIB_TEXT*) DrawItem );
@@ -1058,7 +1058,7 @@ void LIB_EDIT_FRAME::EditSymbolText( wxDC* DC, LIB_ITEM* DrawItem )
// Display new text
if( DC && !DrawItem->InEditMode() )
- DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, GR_DEFAULT_DRAWMODE, NULL,
+ DrawItem->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, GR_DEFAULT_DRAWMODE, NULL,
DefaultTransform );
}
diff --git a/eeschema/pinedit.cpp b/eeschema/pinedit.cpp
index ef97672f6b..3eb01d38a1 100644
--- a/eeschema/pinedit.cpp
+++ b/eeschema/pinedit.cpp
@@ -400,13 +400,13 @@ static void DrawMovePin( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosi
if( aErase )
{
cur_pin->Move( PinPreviousPos );
- cur_pin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode,
+ cur_pin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, g_XorMode,
showOptions, DefaultTransform );
}
// Redraw pin in new position
cur_pin->Move( aPanel->GetParent()->GetCrossHairPosition( true ) );
- cur_pin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, g_XorMode,
+ cur_pin->Draw( aPanel, aDC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, g_XorMode,
showOptions, DefaultTransform );
PinPreviousPos = cur_pin->GetPosition();
@@ -480,7 +480,7 @@ void LIB_EDIT_FRAME::CreatePin( wxDC* DC )
// Build it:
void* showOptions = reinterpret_cast( show_opts );
- pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR, GR_COPY,
+ pin->Draw( m_canvas, DC, wxPoint( 0, 0 ), UNSPECIFIED_COLOR4D, GR_COPY,
showOptions, DefaultTransform );
}
diff --git a/eeschema/protos.h b/eeschema/protos.h
index ae3cf1d00d..441c36d16c 100644
--- a/eeschema/protos.h
+++ b/eeschema/protos.h
@@ -26,8 +26,6 @@
#ifndef __PROTOS_H__
#define __PROTOS_H__
-#include
-
class EDA_DRAW_PANEL;
class PICKED_ITEMS_LIST;
class SCH_ITEM;
@@ -52,7 +50,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct, bool aClone = false );
/* EEREDRAW.CPP */
/****************/
void DrawDanglingSymbol( EDA_DRAW_PANEL* panel, wxDC* DC,
- const wxPoint& pos, EDA_COLOR_T Color );
+ const wxPoint& pos, COLOR4D Color );
#endif /* __PROTOS_H__ */
diff --git a/eeschema/sch_base_frame.cpp b/eeschema/sch_base_frame.cpp
index 52898e822a..bd434c162f 100644
--- a/eeschema/sch_base_frame.cpp
+++ b/eeschema/sch_base_frame.cpp
@@ -63,12 +63,12 @@ void SCH_BASE_FRAME::OnOpenLibraryViewer( wxCommandEvent& event )
}
// Virtual from EDA_DRAW_FRAME
-EDA_COLOR_T SCH_BASE_FRAME::GetDrawBgColor() const
+COLOR4D SCH_BASE_FRAME::GetDrawBgColor() const
{
return GetLayerColor( LAYER_BACKGROUND );
}
-void SCH_BASE_FRAME::SetDrawBgColor( EDA_COLOR_T aColor)
+void SCH_BASE_FRAME::SetDrawBgColor( COLOR4D aColor)
{
m_drawBgColor= aColor;
SetLayerColor( aColor, LAYER_BACKGROUND );
diff --git a/eeschema/sch_base_frame.h b/eeschema/sch_base_frame.h
index 2f96696025..b5a5accbff 100644
--- a/eeschema/sch_base_frame.h
+++ b/eeschema/sch_base_frame.h
@@ -114,8 +114,8 @@ public:
// Virtual from EDA_DRAW_FRAME
// the background color of the draw canvas:
- EDA_COLOR_T GetDrawBgColor() const override;
- void SetDrawBgColor( EDA_COLOR_T aColor) override;
+ COLOR4D GetDrawBgColor() const override;
+ void SetDrawBgColor( COLOR4D aColor) override;
const TITLE_BLOCK& GetTitleBlock() const override;
void SetTitleBlock( const TITLE_BLOCK& aTitleBlock ) override;
diff --git a/eeschema/sch_bitmap.cpp b/eeschema/sch_bitmap.cpp
index fb71b9ddef..66abba1474 100644
--- a/eeschema/sch_bitmap.cpp
+++ b/eeschema/sch_bitmap.cpp
@@ -191,11 +191,11 @@ const EDA_RECT SCH_BITMAP::GetBoundingBox() const
void SCH_BITMAP::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
+ GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
wxPoint pos = m_pos + aOffset;
- if( aColor < 0 ) // Use normal drawing function
+ if( aColor == UNSPECIFIED_COLOR4D ) // Use normal drawing function
{
// https://bugs.launchpad.net/kicad/+bug/1529163
// "Moving images in eeschema on OS X uses
diff --git a/eeschema/sch_bitmap.h b/eeschema/sch_bitmap.h
index 542e03f0eb..d6765747d1 100644
--- a/eeschema/sch_bitmap.h
+++ b/eeschema/sch_bitmap.h
@@ -99,7 +99,7 @@ public:
void SwapData( SCH_ITEM* aItem ) override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
/**
* Function ReadImageFile
diff --git a/eeschema/sch_bus_entry.cpp b/eeschema/sch_bus_entry.cpp
index 5acc9f5df7..b509c04015 100644
--- a/eeschema/sch_bus_entry.cpp
+++ b/eeschema/sch_bus_entry.cpp
@@ -182,12 +182,12 @@ int SCH_BUS_BUS_ENTRY::GetPenSize() const
void SCH_BUS_ENTRY_BASE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
+ GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
- EDA_COLOR_T color;
+ COLOR4D color;
EDA_RECT* clipbox = aPanel->GetClipBox();
- if( aColor >= 0 )
+ if( aColor != UNSPECIFIED_COLOR4D )
color = aColor;
else
color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
diff --git a/eeschema/sch_bus_entry.h b/eeschema/sch_bus_entry.h
index c638443bcf..92e424c6fa 100644
--- a/eeschema/sch_bus_entry.h
+++ b/eeschema/sch_bus_entry.h
@@ -83,7 +83,7 @@ public:
void SwapData( SCH_ITEM* aItem ) override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
static bool Load( LINE_READER& aLine, wxString& aErrorMsg, SCH_ITEM **out );
diff --git a/eeschema/sch_component.cpp b/eeschema/sch_component.cpp
index 9a91450cde..d4c647e54b 100644
--- a/eeschema/sch_component.cpp
+++ b/eeschema/sch_component.cpp
@@ -347,7 +347,7 @@ int SCH_COMPONENT::GetUnitCount() const
void SCH_COMPONENT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor,
+ GR_DRAWMODE aDrawMode, COLOR4D aColor,
bool aDrawPinText )
{
auto opts = PART_DRAW_OPTIONS::Default();
diff --git a/eeschema/sch_component.h b/eeschema/sch_component.h
index cbec577df5..9c82fb70b1 100644
--- a/eeschema/sch_component.h
+++ b/eeschema/sch_component.h
@@ -379,7 +379,7 @@ public:
* Virtual function, from the base class SCH_ITEM::Draw
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override
{
Draw( aPanel, aDC, aOffset, aDrawMode, aColor, true );
}
@@ -392,12 +392,12 @@ public:
* @param aOffset drawing Offset (usually wxPoint(0,0),
* but can be different when moving an object)
* @param aDrawMode GR_OR, GR_XOR, ...
- * @param aColor UNSPECIFIED_COLOR to use the normal body item color, or use this color if >= 0
+ * @param aColor UNSPECIFIED_COLOR4D to use the normal body item color, or use this color if >= 0
* @param aDrawPinText = true to draw pin texts, false to draw only the pin shape
* usually false to draw a component when moving it, and true otherwise.
*/
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor,
+ GR_DRAWMODE aDrawMode, COLOR4D aColor,
bool aDrawPinText );
void SwapData( SCH_ITEM* aItem ) override;
diff --git a/eeschema/sch_field.cpp b/eeschema/sch_field.cpp
index 9cfe13f4a9..a141d5eb48 100644
--- a/eeschema/sch_field.cpp
+++ b/eeschema/sch_field.cpp
@@ -116,10 +116,10 @@ int SCH_FIELD::GetPenSize() const
void SCH_FIELD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
+ GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
int orient;
- EDA_COLOR_T color;
+ COLOR4D color;
wxPoint textpos;
SCH_COMPONENT* parentComponent = (SCH_COMPONENT*) m_Parent;
int lineWidth = GetThickness();
@@ -167,7 +167,7 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
if( m_forceVisible )
{
- color = DARKGRAY;
+ color = COLOR4D( DARKGRAY );
}
else
{
@@ -534,7 +534,7 @@ void SCH_FIELD::Plot( PLOTTER* aPlotter )
wxCHECK_RET( parent != NULL && parent->Type() == SCH_COMPONENT_T,
wxT( "Cannot plot field with invalid parent." ) );
- EDA_COLOR_T color = GetLayerColor( GetLayer() );
+ COLOR4D color = GetLayerColor( GetLayer() );
if( !IsVisible() )
return;
diff --git a/eeschema/sch_field.h b/eeschema/sch_field.h
index d467390a2c..0a94046e8e 100644
--- a/eeschema/sch_field.h
+++ b/eeschema/sch_field.h
@@ -141,7 +141,7 @@ public:
int GetPenSize() const override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
bool Save( FILE* aFile ) const override;
diff --git a/eeschema/sch_item_struct.h b/eeschema/sch_item_struct.h
index 10e083de35..64484ea82b 100644
--- a/eeschema/sch_item_struct.h
+++ b/eeschema/sch_item_struct.h
@@ -184,11 +184,11 @@ public:
* @param aOffset drawing Offset (usually wxPoint(0,0),
* but can be different when moving an object)
* @param aDrawMode GR_OR, GR_XOR, ...
- * @param aColor UNSPECIFIED_COLOR to use the normal body item color,
+ * @param aColor UNSPECIFIED_COLOR4D to use the normal body item color,
* or force this color if it is a valid color
*/
virtual void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) = 0;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) = 0;
/**
* Function Move
diff --git a/eeschema/sch_junction.cpp b/eeschema/sch_junction.cpp
index 4bee5f0ff5..96c86760d3 100644
--- a/eeschema/sch_junction.cpp
+++ b/eeschema/sch_junction.cpp
@@ -111,11 +111,11 @@ const EDA_RECT SCH_JUNCTION::GetBoundingBox() const
void SCH_JUNCTION::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
+ GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
- EDA_COLOR_T color;
+ COLOR4D color;
- if( aColor >= 0 )
+ if( aColor != UNSPECIFIED_COLOR4D )
color = aColor;
else
color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
diff --git a/eeschema/sch_junction.h b/eeschema/sch_junction.h
index 9216a929fd..28a1e23427 100644
--- a/eeschema/sch_junction.h
+++ b/eeschema/sch_junction.h
@@ -58,7 +58,7 @@ public:
const EDA_RECT GetBoundingBox() const override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
bool Save( FILE* aFile ) const override;
diff --git a/eeschema/sch_line.cpp b/eeschema/sch_line.cpp
index e3f21bfd15..05eb3950cf 100644
--- a/eeschema/sch_line.cpp
+++ b/eeschema/sch_line.cpp
@@ -212,12 +212,12 @@ int SCH_LINE::GetPenSize() const
void SCH_LINE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
- GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
+ GR_DRAWMODE DrawMode, COLOR4D Color )
{
- EDA_COLOR_T color;
+ COLOR4D color;
int width = GetPenSize();
- if( Color >= 0 )
+ if( Color != UNSPECIFIED_COLOR4D )
color = Color;
else
color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
diff --git a/eeschema/sch_line.h b/eeschema/sch_line.h
index 9c4937b793..f1cb8c7f38 100644
--- a/eeschema/sch_line.h
+++ b/eeschema/sch_line.h
@@ -85,7 +85,7 @@ public:
double GetLength() const;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
bool Save( FILE* aFile ) const override;
diff --git a/eeschema/sch_marker.cpp b/eeschema/sch_marker.cpp
index d42f1f504e..aaea0364eb 100644
--- a/eeschema/sch_marker.cpp
+++ b/eeschema/sch_marker.cpp
@@ -85,10 +85,10 @@ bool SCH_MARKER::Save( FILE* aFile ) const
void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
- const wxPoint& aOffset, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
+ const wxPoint& aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
- EDA_COLOR_T color = m_Color;
- EDA_COLOR_T tmp = color;
+ COLOR4D color = m_Color;
+ COLOR4D tmp = color;
if( GetMarkerType() == MARKER_BASE::MARKER_ERC )
{
@@ -96,7 +96,7 @@ void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
GetLayerColor( LAYER_ERC_ERR ) : GetLayerColor( LAYER_ERC_WARN );
}
- if( aColor < 0 )
+ if( aColor == UNSPECIFIED_COLOR4D )
m_Color = color;
else
m_Color = aColor;
diff --git a/eeschema/sch_marker.h b/eeschema/sch_marker.h
index 15e58beffd..a6e9199f6e 100644
--- a/eeschema/sch_marker.h
+++ b/eeschema/sch_marker.h
@@ -53,7 +53,7 @@ public:
}
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDraw_mode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDraw_mode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
void Plot( PLOTTER* aPlotter ) override
{
diff --git a/eeschema/sch_no_connect.cpp b/eeschema/sch_no_connect.cpp
index 623edf4578..a54c6d87cc 100644
--- a/eeschema/sch_no_connect.cpp
+++ b/eeschema/sch_no_connect.cpp
@@ -128,7 +128,7 @@ int SCH_NO_CONNECT::GetPenSize() const
void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
+ GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
int pX, pY;
int delta = m_size.x / 2;
@@ -137,8 +137,9 @@ void SCH_NO_CONNECT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOf
pX = m_pos.x + aOffset.x;
pY = m_pos.y + aOffset.y;
- EDA_COLOR_T color;
- if( aColor >= 0 )
+ COLOR4D color;
+
+ if( aColor != UNSPECIFIED_COLOR4D )
color = aColor;
else
color = GetLayerColor( LAYER_NOCONNECT );
diff --git a/eeschema/sch_no_connect.h b/eeschema/sch_no_connect.h
index 5360f073c7..6ef94e5a71 100644
--- a/eeschema/sch_no_connect.h
+++ b/eeschema/sch_no_connect.h
@@ -56,7 +56,7 @@ public:
void SwapData( SCH_ITEM* aItem ) override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
bool Save( FILE* aFile ) const override;
diff --git a/eeschema/sch_screen.cpp b/eeschema/sch_screen.cpp
index 113da38ad4..9b68862b68 100644
--- a/eeschema/sch_screen.cpp
+++ b/eeschema/sch_screen.cpp
@@ -558,7 +558,7 @@ void SCH_SCREEN::CheckComponentsToPartsLinks()
}
-void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
+void SCH_SCREEN::Draw( EDA_DRAW_PANEL* aCanvas, wxDC* aDC, GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
/* note: SCH_SCREEN::Draw is useful only for schematic.
* library editor and library viewer do not use m_drawList, and therefore
@@ -927,7 +927,9 @@ bool SCH_SCREEN::TestDanglingEnds()
for( item = m_drawList.begin(); item; item = item->Next() )
{
if( item->IsDanglingStateChanged( endPoints ) )
+ {
hasStateChanged = true;
+ }
}
return hasStateChanged;
diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp
index 0ccedbfcd7..7c55b8de15 100644
--- a/eeschema/sch_sheet.cpp
+++ b/eeschema/sch_sheet.cpp
@@ -581,18 +581,18 @@ wxPoint SCH_SHEET::GetFileNamePosition()
void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
- const wxPoint& aOffset, GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
+ const wxPoint& aOffset, GR_DRAWMODE aDrawMode, COLOR4D aColor )
{
- EDA_COLOR_T txtcolor;
+ COLOR4D txtcolor;
wxString Text;
- EDA_COLOR_T color;
+ COLOR4D color;
int name_orientation;
wxPoint pos_sheetname,pos_filename;
wxPoint pos = m_pos + aOffset;
int lineWidth = GetPenSize();
EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
- if( aColor >= 0 )
+ if( aColor != UNSPECIFIED_COLOR4D )
color = aColor;
else
color = GetLayerColor( m_Layer );
@@ -611,7 +611,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
name_orientation = TEXT_ANGLE_HORIZ;
/* Draw text : SheetName */
- if( aColor > 0 )
+ if( aColor != UNSPECIFIED_COLOR4D )
txtcolor = aColor;
else
txtcolor = GetLayerColor( LAYER_SHEETNAME );
@@ -624,7 +624,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
false, false );
/* Draw text : FileName */
- if( aColor >= 0 )
+ if( aColor != UNSPECIFIED_COLOR4D )
txtcolor = aColor;
else
txtcolor = GetLayerColor( LAYER_SHEETFILENAME );
@@ -1138,7 +1138,7 @@ void SCH_SHEET::GetNetListItem( NETLIST_OBJECT_LIST& aNetListItems,
void SCH_SHEET::Plot( PLOTTER* aPlotter )
{
- EDA_COLOR_T txtcolor = UNSPECIFIED_COLOR;
+ COLOR4D txtcolor = UNSPECIFIED_COLOR4D;
wxSize size;
wxString Text;
int name_orientation;
diff --git a/eeschema/sch_sheet.h b/eeschema/sch_sheet.h
index 454de54d08..55037b6d20 100644
--- a/eeschema/sch_sheet.h
+++ b/eeschema/sch_sheet.h
@@ -113,7 +113,7 @@ public:
bool IsMovableFromAnchorPoint() override { return true; }
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
/**
* Function CreateGraphicShape (virtual)
@@ -429,7 +429,7 @@ public:
int GetPenSize() const override;
void Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
EDA_RECT const GetBoundingBox() const override;
diff --git a/eeschema/sch_sheet_pin.cpp b/eeschema/sch_sheet_pin.cpp
index 9dcdfb1b92..f1acc23823 100644
--- a/eeschema/sch_sheet_pin.cpp
+++ b/eeschema/sch_sheet_pin.cpp
@@ -72,7 +72,7 @@ void SCH_SHEET_PIN::Draw( EDA_DRAW_PANEL* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDraw_mode,
- EDA_COLOR_T aColor )
+ COLOR4D aColor )
{
// The icon selection is handle by the virtual method CreateGraphicShape
// called by ::Draw
diff --git a/eeschema/sch_text.cpp b/eeschema/sch_text.cpp
index a9d8982eb8..962cc16086 100644
--- a/eeschema/sch_text.cpp
+++ b/eeschema/sch_text.cpp
@@ -342,15 +342,15 @@ int SCH_TEXT::GetPenSize() const
void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
- GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
+ GR_DRAWMODE DrawMode, COLOR4D Color )
{
- EDA_COLOR_T color;
+ COLOR4D color;
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
- if( Color >= 0 )
+ if( Color != UNSPECIFIED_COLOR4D )
color = Color;
else
color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
@@ -362,7 +362,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
int savedWidth = GetThickness();
SetThickness( linewidth ); // Set the minimum width
- EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
+ EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR4D );
SetThickness( savedWidth );
@@ -676,8 +676,8 @@ bool SCH_TEXT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy )
void SCH_TEXT::Plot( PLOTTER* aPlotter )
{
static std::vector Poly;
- EDA_COLOR_T color = GetLayerColor( GetLayer() );
- int thickness = GetPenSize();
+ COLOR4D color = GetLayerColor( GetLayer() );
+ int thickness = GetPenSize();
aPlotter->SetCurrentLineWidth( thickness );
@@ -979,7 +979,7 @@ bool SCH_LABEL::Load( LINE_READER& aLine, wxString& aErrorMsg )
void SCH_LABEL::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
- GR_DRAWMODE DrawMode, EDA_COLOR_T Color )
+ GR_DRAWMODE DrawMode, COLOR4D Color )
{
SCH_TEXT::Draw( panel, DC, offset, DrawMode, Color );
}
@@ -1269,13 +1269,13 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& aOffset,
GR_DRAWMODE DrawMode,
- EDA_COLOR_T Color )
+ COLOR4D Color )
{
static std::vector Poly;
- EDA_COLOR_T color;
+ COLOR4D color;
wxPoint text_offset = aOffset + GetSchematicTextOffset();
- if( Color >= 0 )
+ if( Color != UNSPECIFIED_COLOR4D )
color = Color;
else
color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
@@ -1290,7 +1290,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
SetThickness( linewidth );
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
- EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
+ EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR4D );
SetThickness( save_width ); // restore initial value
@@ -1636,16 +1636,16 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
wxDC* DC,
const wxPoint& offset,
GR_DRAWMODE DrawMode,
- EDA_COLOR_T Color )
+ COLOR4D Color )
{
static std::vector Poly;
- EDA_COLOR_T color;
+ COLOR4D color;
int linewidth = GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
linewidth = Clamp_Text_PenSize( linewidth, GetTextSize(), IsBold() );
- if( Color >= 0 )
+ if( Color != UNSPECIFIED_COLOR4D )
color = Color;
else
color = GetLayerColor( GetState( BRIGHTENED ) ? LAYER_BRIGHTENED : m_Layer );
@@ -1656,7 +1656,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
SetThickness( linewidth );
wxPoint text_offset = offset + GetSchematicTextOffset();
- EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
+ EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR4D );
SetThickness( save_width ); // restore initial value
diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h
index e0da769d15..8aed3e5d65 100644
--- a/eeschema/sch_text.h
+++ b/eeschema/sch_text.h
@@ -132,7 +132,7 @@ public:
virtual wxPoint GetSchematicTextOffset() const;
virtual void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
- GR_DRAWMODE draw_mode, EDA_COLOR_T Color = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE draw_mode, COLOR4D Color = UNSPECIFIED_COLOR4D ) override;
/**
* Function CreateGraphicShape
@@ -228,7 +228,7 @@ public:
~SCH_LABEL() { }
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
- GR_DRAWMODE draw_mode, EDA_COLOR_T Color = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE draw_mode, COLOR4D Color = UNSPECIFIED_COLOR4D ) override;
wxString GetClass() const override
{
@@ -274,7 +274,7 @@ public:
~SCH_GLOBALLABEL() { }
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
- GR_DRAWMODE draw_mode, EDA_COLOR_T Color = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE draw_mode, COLOR4D Color = UNSPECIFIED_COLOR4D ) override;
wxString GetClass() const override
{
@@ -324,7 +324,7 @@ public:
~SCH_HIERLABEL() { }
void Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& offset,
- GR_DRAWMODE draw_mode, EDA_COLOR_T Color = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE draw_mode, COLOR4D Color = UNSPECIFIED_COLOR4D ) override;
wxString GetClass() const override
{
diff --git a/eeschema/schedit.cpp b/eeschema/schedit.cpp
index 46bfa3db1e..b43d233a31 100644
--- a/eeschema/schedit.cpp
+++ b/eeschema/schedit.cpp
@@ -708,7 +708,7 @@ static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( aErase )
{
if( cmp ) // Use fast mode (do not draw pin texts)
- cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, UNSPECIFIED_COLOR, false );
+ cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, UNSPECIFIED_COLOR4D, false );
else
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}
@@ -723,7 +723,7 @@ static void moveItemWithMouseCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
item->SetWireImage(); // While moving, the item may choose to render differently
if( cmp ) // Use fast mode (do not draw pin texts)
- cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, UNSPECIFIED_COLOR, false );
+ cmp->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode, UNSPECIFIED_COLOR4D, false );
else
item->Draw( aPanel, aDC, wxPoint( 0, 0 ), g_XorMode );
}
diff --git a/eeschema/sim/sim_plot_frame.cpp b/eeschema/sim/sim_plot_frame.cpp
index bf04f24e3b..c327d332e3 100644
--- a/eeschema/sim/sim_plot_frame.cpp
+++ b/eeschema/sim/sim_plot_frame.cpp
@@ -561,7 +561,7 @@ void SIM_PLOT_FRAME::updateSignalList()
{
wxBitmap bitmap( isize, isize );
bmDC.SelectObject( bitmap );
- wxColor tcolor = trace.second->GetTraceColour();
+ wxColour tcolor = trace.second->GetTraceColour();
wxColour bgColor = m_signals->wxWindow::GetBackgroundColour();
bmDC.SetPen( wxPen( bgColor ) );
diff --git a/eeschema/symbdraw.cpp b/eeschema/symbdraw.cpp
index 136c914b14..0e6d23d494 100644
--- a/eeschema/symbdraw.cpp
+++ b/eeschema/symbdraw.cpp
@@ -240,7 +240,7 @@ void LIB_EDIT_FRAME::GraphicItemBeginDraw( wxDC* DC )
if( m_drawItem->ContinueEdit( pos ) )
{
- m_drawItem->Draw( m_canvas, DC, pos, UNSPECIFIED_COLOR, g_XorMode, NULL, DefaultTransform );
+ m_drawItem->Draw( m_canvas, DC, pos, UNSPECIFIED_COLOR4D, g_XorMode, NULL, DefaultTransform );
return;
}
@@ -270,12 +270,12 @@ static void RedrawWhileMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
wxString text = ((LIB_FIELD*)item)->GetFullText( unit );
item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
- UNSPECIFIED_COLOR, g_XorMode, &text,
+ UNSPECIFIED_COLOR4D, g_XorMode, &text,
DefaultTransform );
}
else
item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ),
- UNSPECIFIED_COLOR, g_XorMode, NULL,
+ UNSPECIFIED_COLOR4D, g_XorMode, NULL,
DefaultTransform );
}
@@ -323,7 +323,7 @@ static void SymbolDisplayDraw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint&
return;
item->SetEraseLastDrawItem( aErase );
- item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ), UNSPECIFIED_COLOR, g_XorMode, NULL,
+ item->Draw( aPanel, aDC, aPanel->GetParent()->GetCrossHairPosition( true ), UNSPECIFIED_COLOR4D, g_XorMode, NULL,
DefaultTransform );
}
diff --git a/eeschema/widgets/widget_eeschema_color_config.cpp b/eeschema/widgets/widget_eeschema_color_config.cpp
index d8dd97f673..9db4a7daec 100644
--- a/eeschema/widgets/widget_eeschema_color_config.cpp
+++ b/eeschema/widgets/widget_eeschema_color_config.cpp
@@ -33,9 +33,6 @@
#include "widget_eeschema_color_config.h"
-// See selcolor.cpp:
-extern EDA_COLOR_T DisplayColorFrame( wxWindow* aParent, EDA_COLOR_T aOldColor );
-
// Specify the width and height of every (color-displaying / bitmap) button
const int BUTT_SIZE_X = 16;
const int BUTT_SIZE_Y = 16;
@@ -107,8 +104,9 @@ static BUTTONINDEX buttonGroups[] = {
{ wxT( "" ), NULL }
};
+static COLORBUTTON bgColorButton = { _( "" ), LAYER_BACKGROUND };
-static EDA_COLOR_T currentColors[ LAYERSCH_ID_COUNT ];
+static COLOR4D currentColors[ LAYERSCH_ID_COUNT ];
WIDGET_EESCHEMA_COLOR_CONFIG::WIDGET_EESCHEMA_COLOR_CONFIG( wxWindow* aParent, EDA_DRAW_FRAME* aDrawFrame ) :
@@ -153,28 +151,16 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
rowBoxSizer = new wxBoxSizer( wxHORIZONTAL );
columnBoxSizer->Add( rowBoxSizer, 0, wxGROW | wxALL, 0 );
- wxMemoryDC iconDC;
- wxBitmap bitmap( BUTT_SIZE_X, BUTT_SIZE_Y );
-
- iconDC.SelectObject( bitmap );
-
- EDA_COLOR_T color = GetLayerColor( LAYERSCH_ID( buttons->m_Layer ) );
+ COLOR4D color = GetLayerColor( LAYERSCH_ID( buttons->m_Layer ) );
currentColors[ buttons->m_Layer ] = color;
- iconDC.SetPen( *wxBLACK_PEN );
+ wxColourPickerCtrl* colourPicker = new wxColourPickerCtrl(
+ this, buttonId, color.ToColour(), wxDefaultPosition,
+ wxSize( BUTT_SIZE_X+20, BUTT_SIZE_Y+20 ) );
- wxBrush brush;
- ColorSetBrush( &brush, color );
- brush.SetStyle( wxBRUSHSTYLE_SOLID );
- iconDC.SetBrush( brush );
- iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
+ colourPicker->SetClientData( (void*) buttons );
- wxBitmapButton* bitmapButton = new wxBitmapButton(
- this, buttonId, bitmap, wxDefaultPosition,
- wxSize( BUTT_SIZE_X+8, BUTT_SIZE_Y+6 ) );
- bitmapButton->SetClientData( (void*) buttons );
-
- rowBoxSizer->Add( bitmapButton, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
+ rowBoxSizer->Add( colourPicker, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
label = new wxStaticText( this, wxID_ANY, wxGetTranslation( buttons->m_Name ) );
rowBoxSizer->Add( label, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
@@ -185,25 +171,38 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
groups++;
}
- Connect( 1800, buttonId - 1, wxEVT_COMMAND_BUTTON_CLICKED,
+ Connect( 1800, buttonId - 1, wxEVT_COLOURPICKER_CHANGED,
wxCommandEventHandler( WIDGET_EESCHEMA_COLOR_CONFIG::SetColor ) );
- wxArrayString selBgColorStrings;
+ /*wxArrayString selBgColorStrings;
selBgColorStrings.Add( _( "White" ) );
selBgColorStrings.Add( _( "Black" ) );
m_SelBgColor = new wxRadioBox( this, wxID_ANY, _( "Background Color" ),
wxDefaultPosition, wxDefaultSize,
selBgColorStrings, 1, wxRA_SPECIFY_COLS );
m_SelBgColor->SetSelection( ( GetDrawFrame()->GetDrawBgColor() == BLACK ) ? 1 : 0 );
+ */
+
+ COLOR4D bgColor = GetDrawFrame()->GetDrawBgColor();
+ m_SelBgColor = new wxColourPickerCtrl(
+ this, buttonId, bgColor.ToColour(), wxDefaultPosition,
+ wxSize( BUTT_SIZE_X+20, BUTT_SIZE_Y+20 ) );
+
+ wxStaticText* bgColorLabel = new wxStaticText( this, wxID_ANY, _( "Background Color" ) );
+ wxFont font( bgColorLabel->GetFont() );
+ font.SetWeight( wxFONTWEIGHT_BOLD );
+ bgColorLabel->SetFont( font );
if( columnBoxSizer )
{
// Add a spacer to improve appearance.
columnBoxSizer->AddSpacer( 5 );
- columnBoxSizer->Add( m_SelBgColor, 1, wxGROW | wxRIGHT | wxTOP | wxBOTTOM, 5 );
+ columnBoxSizer->Add( bgColorLabel, 1, wxALIGN_CENTER_VERTICAL | wxALL, 5 );
+ columnBoxSizer->Add( m_SelBgColor, 1, wxALIGN_CENTER_VERTICAL | wxRIGHT | wxBOTTOM, 5 );
}
- currentColors[ LAYER_BACKGROUND ] = GetDrawFrame()->GetDrawBgColor();
+ // TODO(jon) fix currentColors
+ //currentColors[ LAYER_BACKGROUND ] = GetDrawFrame()->GetDrawBgColor();
// Dialog now needs to be resized, but the associated command is found elsewhere.
}
@@ -211,38 +210,22 @@ void WIDGET_EESCHEMA_COLOR_CONFIG::CreateControls()
void WIDGET_EESCHEMA_COLOR_CONFIG::SetColor( wxCommandEvent& event )
{
- wxBitmapButton* button = (wxBitmapButton*) event.GetEventObject();
+ wxColourPickerCtrl* picker = (wxColourPickerCtrl*) event.GetEventObject();
- wxCHECK_RET( button != NULL, wxT( "Color button event object is NULL." ) );
+ wxCHECK_RET( picker != NULL, wxT( "Color picker event object is NULL." ) );
- COLORBUTTON* colorButton = (COLORBUTTON*) button->GetClientData();
+ COLORBUTTON* colorButton = (COLORBUTTON*) picker->GetClientData();
wxCHECK_RET( colorButton != NULL, wxT( "Client data not set for color button." ) );
- EDA_COLOR_T color = DisplayColorFrame( this, currentColors[colorButton->m_Layer] );
+ // DisplayColorFrame( this, currentColors[colorButton->m_Layer] );
+ COLOR4D color = COLOR4D( picker->GetColour() );
- if( color < 0 || currentColors[ colorButton->m_Layer ] == color )
+ if( color == UNSPECIFIED_COLOR4D || currentColors[ colorButton->m_Layer ] == color )
return;
currentColors[ colorButton->m_Layer ] = color;
- wxMemoryDC iconDC;
-
- wxBitmap bitmap = button->GetBitmapLabel();
- iconDC.SelectObject( bitmap );
- iconDC.SetPen( *wxBLACK_PEN );
-
- wxBrush brush;
-
- ColorSetBrush( &brush, color);
-
- brush.SetStyle( wxBRUSHSTYLE_SOLID );
-
- iconDC.SetBrush( brush );
- iconDC.DrawRectangle( 0, 0, BUTT_SIZE_X, BUTT_SIZE_Y );
- button->SetBitmapLabel( bitmap );
- button->Refresh();
-
Refresh( false );
}
@@ -254,10 +237,7 @@ bool WIDGET_EESCHEMA_COLOR_CONFIG::TransferDataFromControl()
// Check for color conflicts with background color to give user a chance to bail
// out before making changes.
- EDA_COLOR_T bgcolor = WHITE;
-
- if( m_SelBgColor->GetSelection() > 0 )
- bgcolor = BLACK;
+ COLOR4D bgcolor = m_SelBgColor->GetColour();
for( LAYERSCH_ID clyr = LAYER_WIRE; clyr < LAYERSCH_ID_COUNT; ++clyr )
{
diff --git a/eeschema/widgets/widget_eeschema_color_config.h b/eeschema/widgets/widget_eeschema_color_config.h
index 1f99a31193..6f9fb8a076 100644
--- a/eeschema/widgets/widget_eeschema_color_config.h
+++ b/eeschema/widgets/widget_eeschema_color_config.h
@@ -27,6 +27,8 @@
#include
#include
+#include
+#include
class wxBoxSizer;
class wxStaticLine;
@@ -41,7 +43,7 @@ class WIDGET_EESCHEMA_COLOR_CONFIG : public wxPanel
{
private:
EDA_DRAW_FRAME* m_drawFrame;
- wxRadioBox* m_SelBgColor;
+ wxColourPickerCtrl* m_SelBgColor;
wxBoxSizer* m_mainBoxSizer;
// Creates the controls and sizers
diff --git a/gerbview/CMakeLists.txt b/gerbview/CMakeLists.txt
index e919ac5e8c..fec3088d94 100644
--- a/gerbview/CMakeLists.txt
+++ b/gerbview/CMakeLists.txt
@@ -102,6 +102,7 @@ target_link_libraries( gerbview
# There's way too much crap coming in from common yet.
common
bitmaps
+ gal
${wxWidgets_LIBRARIES}
)
diff --git a/gerbview/block.cpp b/gerbview/block.cpp
index c2345ab67c..d284d7da74 100644
--- a/gerbview/block.cpp
+++ b/gerbview/block.cpp
@@ -148,7 +148,7 @@ static void DrawMovingBlockOutlines( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wx
{
BASE_SCREEN* screen = aPanel->GetScreen();
- EDA_COLOR_T Color = YELLOW;
+ COLOR4D Color = COLOR4D( YELLOW );
if( aErase )
{
diff --git a/gerbview/class_aperture_macro.cpp b/gerbview/class_aperture_macro.cpp
index 8a04c2f604..41fb469e2a 100644
--- a/gerbview/class_aperture_macro.cpp
+++ b/gerbview/class_aperture_macro.cpp
@@ -712,7 +712,7 @@ int AM_PRIMITIVE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
*/
void APERTURE_MACRO::DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent,
EDA_RECT* aClipBox, wxDC* aDC,
- EDA_COLOR_T aColor,
+ COLOR4D aColor,
wxPoint aShapePos, bool aFilledShape )
{
SHAPE_POLY_SET shapeBuffer;
diff --git a/gerbview/class_aperture_macro.h b/gerbview/class_aperture_macro.h
index 816e461c39..0b88de2894 100644
--- a/gerbview/class_aperture_macro.h
+++ b/gerbview/class_aperture_macro.h
@@ -195,7 +195,7 @@ struct APERTURE_MACRO
* @param aFilledShape = true to draw in filled mode, false to draw in skecth mode
*/
void DrawApertureMacroShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox, wxDC* aDC,
- EDA_COLOR_T aColor, wxPoint aShapePos, bool aFilledShape );
+ COLOR4D aColor, wxPoint aShapePos, bool aFilledShape );
/**
* Function GetShapeDim
diff --git a/gerbview/class_gbr_display_options.h b/gerbview/class_gbr_display_options.h
index 7541d58a15..3ff5179ce6 100644
--- a/gerbview/class_gbr_display_options.h
+++ b/gerbview/class_gbr_display_options.h
@@ -31,8 +31,6 @@
#ifndef CLASS_GBR_DISPLAY_OPTIONS_H
#define CLASS_GBR_DISPLAY_OPTIONS_H
-#include
-
/**
* @note Some of these parameters are used only for printing, some others only
* for drawing on screen.
@@ -49,10 +47,10 @@ public:
bool m_DisplayNegativeObjects; ///< Option to draw negative objects in a specific color
bool m_IsPrinting; ///< true when printing a page, false when drawing on screen
bool m_ForceBlackAndWhite; ///< Option print in blackand white (ont used id draw mode
- EDA_COLOR_T m_NegativeDrawColor; ///< The color used to draw negative objects, usually the
+ COLOR4D m_NegativeDrawColor; ///< The color used to draw negative objects, usually the
///< background color, but not always, when negative objects
///< must be visible
- EDA_COLOR_T m_BgDrawColor; ///< The background color
+ COLOR4D m_BgDrawColor; ///< The background color
public:
GBR_DISPLAY_OPTIONS()
@@ -65,8 +63,8 @@ public:
m_IsPrinting = false;
m_DisplayNegativeObjects = false;
m_ForceBlackAndWhite = false;
- m_NegativeDrawColor = DARKGRAY;
- m_BgDrawColor = BLACK;
+ m_NegativeDrawColor = COLOR4D( DARKGRAY );
+ m_BgDrawColor = COLOR4D_BLACK;
}
};
diff --git a/gerbview/class_gbr_layer_box_selector.cpp b/gerbview/class_gbr_layer_box_selector.cpp
index c28569af5b..7ebb47d14d 100644
--- a/gerbview/class_gbr_layer_box_selector.cpp
+++ b/gerbview/class_gbr_layer_box_selector.cpp
@@ -70,7 +70,7 @@ void GBR_LAYER_BOX_SELECTOR::Resync()
// Returns a color index from the layer id
-EDA_COLOR_T GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayer ) const
+COLOR4D GBR_LAYER_BOX_SELECTOR::GetLayerColor( int aLayer ) const
{
GERBVIEW_FRAME* frame = (GERBVIEW_FRAME*) GetParent()->GetParent();
diff --git a/gerbview/class_gbr_layer_box_selector.h b/gerbview/class_gbr_layer_box_selector.h
index 382379e685..bf9631883d 100644
--- a/gerbview/class_gbr_layer_box_selector.h
+++ b/gerbview/class_gbr_layer_box_selector.h
@@ -46,7 +46,7 @@ public:
// Returns a color index from the layer id
// Virtual function
- EDA_COLOR_T GetLayerColor( int aLayer ) const override;
+ COLOR4D GetLayerColor( int aLayer ) const override;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
diff --git a/gerbview/class_gbr_layout.cpp b/gerbview/class_gbr_layout.cpp
index b9588d0774..ebba33f4c0 100644
--- a/gerbview/class_gbr_layout.cpp
+++ b/gerbview/class_gbr_layout.cpp
@@ -155,8 +155,8 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
wxPoint dev_org = aDC->GetDeviceOrigin();
wxPoint logical_org = aDC->GetLogicalOrigin( );
- wxColour bgColor = MakeColour( aDisplayOptions->m_BgDrawColor );
- wxBrush bgBrush( bgColor, wxBRUSHSTYLE_SOLID );
+ COLOR4D bgColor = aDisplayOptions->m_BgDrawColor;
+ wxBrush bgBrush( bgColor.ToColour(), wxBRUSHSTYLE_SOLID );
if( useBufferBitmap )
{
@@ -233,7 +233,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
// Use the layer bitmap itself as a mask when blitting. The bitmap
// cannot be referenced by a device context when setting the mask.
layerDC.SelectObject( wxNullBitmap );
- layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor ) );
+ layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor.ToColour() ) );
layerDC.SelectObject( *layerBitmap );
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxCOPY, true );
}
@@ -264,7 +264,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( gerber->m_ImageNegative )
{
// Draw background negative (i.e. in graphic layer color) for negative images.
- EDA_COLOR_T neg_color = gerber->GetPositiveDrawColor();
+ COLOR4D neg_color = gerber->GetPositiveDrawColor();
GRSetDrawMode( &layerDC, GR_COPY );
GRFilledRect( &drawBox, plotDC, drawBox.GetX(), drawBox.GetY(),
@@ -328,7 +328,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( aDrawMode == GR_COPY )
{
layerDC.SelectObject( wxNullBitmap );
- layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor ) );
+ layerBitmap->SetMask( new wxMask( *layerBitmap, bgColor.ToColour() ) );
layerDC.SelectObject( *layerBitmap );
screenDC.Blit( 0, 0, bitmapWidth, bitmapHeight, &layerDC, 0, 0, wxCOPY, true );
@@ -364,7 +364,7 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
void GBR_LAYOUT::DrawItemsDCodeID( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aDrawColor )
+ GR_DRAWMODE aDrawMode, COLOR4D aDrawColor )
{
wxPoint pos;
int width;
diff --git a/gerbview/class_gbr_layout.h b/gerbview/class_gbr_layout.h
index 563b2b83a9..477136e980 100644
--- a/gerbview/class_gbr_layout.h
+++ b/gerbview/class_gbr_layout.h
@@ -125,7 +125,7 @@ public:
* @param aDrawColor = the color of dcode texts
*/
void DrawItemsDCodeID( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aDrawColor );
+ GR_DRAWMODE aDrawMode, COLOR4D aDrawColor );
/**
diff --git a/gerbview/class_gerber_draw_item.cpp b/gerbview/class_gerber_draw_item.cpp
index 4ddb771135..653c5c0b56 100644
--- a/gerbview/class_gerber_draw_item.cpp
+++ b/gerbview/class_gerber_draw_item.cpp
@@ -282,12 +282,10 @@ void GERBER_DRAW_ITEM::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDra
if( d_codeDescr == NULL )
d_codeDescr = &dummyD_CODE;
- EDA_COLOR_T color = m_GerberImageFile->GetPositiveDrawColor();
+ COLOR4D color = m_GerberImageFile->GetPositiveDrawColor();
- if( aDrawMode & GR_HIGHLIGHT )
- ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) );
-
- ColorApplyHighlightFlag( &color );
+ if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
+ color.SetToLegacyHighlightColor();
/* isDark is true if flash is positive and should use a drawing
* color other than the background color, else use the background color
@@ -479,7 +477,7 @@ void GERBER_DRAW_ITEM::ConvertSegmentToPolygon( )
void GERBER_DRAW_ITEM::DrawGbrPoly( EDA_RECT* aClipBox,
wxDC* aDC,
- EDA_COLOR_T aColor,
+ COLOR4D aColor,
const wxPoint& aOffset,
bool aFilledShape )
{
diff --git a/gerbview/class_gerber_draw_item.h b/gerbview/class_gerber_draw_item.h
index a64e0be44e..832528fb79 100644
--- a/gerbview/class_gerber_draw_item.h
+++ b/gerbview/class_gerber_draw_item.h
@@ -221,7 +221,7 @@ public:
* Function DrawGbrPoly
* a helper function used to draw the polygon stored in m_PolyCorners
*/
- void DrawGbrPoly( EDA_RECT* aClipBox, wxDC* aDC, EDA_COLOR_T aColor,
+ void DrawGbrPoly( EDA_RECT* aClipBox, wxDC* aDC, COLOR4D aColor,
const wxPoint& aOffset, bool aFilledShape );
/* divers */
diff --git a/gerbview/class_gerber_file_image.h b/gerbview/class_gerber_file_image.h
index fddb4d7da0..00a89b7372 100644
--- a/gerbview/class_gerber_file_image.h
+++ b/gerbview/class_gerber_file_image.h
@@ -109,7 +109,7 @@ public:
// (a file is loaded in it)
bool m_IsVisible; // true if the draw layer is visible and must be drawn
// false if it must be not drawn
- EDA_COLOR_T m_PositiveDrawColor; // The color used to draw positive items
+ COLOR4D m_PositiveDrawColor; // The color used to draw positive items
wxString m_FileName; // Full File Name for this layer
wxString m_ImageName; // Image name, from IN * command
bool m_IsX2_file; // true if a X2 gerber attribute was found in file
@@ -203,7 +203,7 @@ public:
virtual void ResetDefaultValues();
- EDA_COLOR_T GetPositiveDrawColor() const { return m_PositiveDrawColor; }
+ COLOR4D GetPositiveDrawColor() const { return m_PositiveDrawColor; }
/**
* Function GetItemsList
diff --git a/gerbview/class_gerbview_layer_widget.cpp b/gerbview/class_gerbview_layer_widget.cpp
index aeb53cd2b7..cc33e89306 100644
--- a/gerbview/class_gerbview_layer_widget.cpp
+++ b/gerbview/class_gerbview_layer_widget.cpp
@@ -114,7 +114,7 @@ void GERBER_LAYER_WIDGET::ReFillRender()
for( unsigned row=0; rowGetVisibleElementColor(
(GERBER_VISIBLE_ID)renderRows[row].id );
@@ -252,7 +252,7 @@ void GERBER_LAYER_WIDGET::ReFill()
//------------------------------------------------
-void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
+void GERBER_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor )
{
myframe->SetLayerColor( aLayer, aColor );
myframe->m_SelLayerBox->ResyncBitmapOnly();
@@ -291,7 +291,7 @@ void GERBER_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFin
myframe->GetCanvas()->Refresh();
}
-void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor )
+void GERBER_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
{
myframe->SetVisibleElementColor( (GERBER_VISIBLE_ID)aId, aColor );
myframe->GetCanvas()->Refresh();
diff --git a/gerbview/class_gerbview_layer_widget.h b/gerbview/class_gerbview_layer_widget.h
index f59de186d0..8e5c6ef18f 100644
--- a/gerbview/class_gerbview_layer_widget.h
+++ b/gerbview/class_gerbview_layer_widget.h
@@ -100,10 +100,10 @@ public:
void ReFillRender();
//----------------
- void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) override;
+ void OnLayerColorChange( int aLayer, COLOR4D aColor ) override;
bool OnLayerSelect( int aLayer ) override;
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) override;
- void OnRenderColorChange( int aId, EDA_COLOR_T aColor ) override;
+ void OnRenderColorChange( int aId, COLOR4D aColor ) override;
void OnRenderEnable( int aId, bool isEnabled ) override;
/**
diff --git a/gerbview/dcode.cpp b/gerbview/dcode.cpp
index 992cf9cf53..b7cd055cb7 100644
--- a/gerbview/dcode.cpp
+++ b/gerbview/dcode.cpp
@@ -151,7 +151,7 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent,
- EDA_RECT* aClipBox, wxDC* aDC, EDA_COLOR_T aColor,
+ EDA_RECT* aClipBox, wxDC* aDC, COLOR4D aColor,
wxPoint aShapePos, bool aFilledShape )
{
int radius;
@@ -268,7 +268,7 @@ void D_CODE::DrawFlashedShape( GERBER_DRAW_ITEM* aParent,
void D_CODE::DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent,
EDA_RECT* aClipBox, wxDC* aDC,
- EDA_COLOR_T aColor, bool aFilled,
+ COLOR4D aColor, bool aFilled,
const wxPoint& aPosition )
{
if( m_PolyCorners.size() == 0 )
diff --git a/gerbview/dcode.h b/gerbview/dcode.h
index d809848dc0..31c98268b5 100644
--- a/gerbview/dcode.h
+++ b/gerbview/dcode.h
@@ -33,8 +33,11 @@
#include
#include
+#include
+using KIGFX::COLOR4D;
+class wxDC;
class GERBER_DRAW_ITEM;
@@ -173,7 +176,7 @@ public:
* @param aFilledShape = true to draw in filled mode, false to draw in sketch mode
*/
void DrawFlashedShape( GERBER_DRAW_ITEM* aParent, EDA_RECT* aClipBox,
- wxDC* aDC, EDA_COLOR_T aColor,
+ wxDC* aDC, COLOR4D aColor,
wxPoint aShapePos, bool aFilledShape );
/**
@@ -190,7 +193,7 @@ public:
* @param aPosition = the actual shape position
*/
void DrawFlashedPolygon( GERBER_DRAW_ITEM* aParent,
- EDA_RECT* aClipBox, wxDC* aDC, EDA_COLOR_T aColor,
+ EDA_RECT* aClipBox, wxDC* aDC, COLOR4D aColor,
bool aFilled, const wxPoint& aPosition );
/**
diff --git a/gerbview/draw_gerber_screen.cpp b/gerbview/draw_gerber_screen.cpp
index 93f14d4394..022db48575 100644
--- a/gerbview/draw_gerber_screen.cpp
+++ b/gerbview/draw_gerber_screen.cpp
@@ -120,7 +120,7 @@ void GERBVIEW_FRAME::RedrawActiveWindow( wxDC* DC, bool EraseBg )
if( m_DisplayOptions.m_DisplayDCodes )
{
- EDA_COLOR_T dcode_color = GetVisibleElementColor( DCODES_VISIBLE );
+ COLOR4D dcode_color = GetVisibleElementColor( DCODES_VISIBLE );
GetGerberLayout()->DrawItemsDCodeID( m_canvas, DC, GR_COPY, dcode_color );
}
diff --git a/gerbview/gerbview_config.cpp b/gerbview/gerbview_config.cpp
index 7d35e06ae4..d53b028cc1 100644
--- a/gerbview/gerbview_config.cpp
+++ b/gerbview/gerbview_config.cpp
@@ -103,15 +103,15 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
false ) );
// Default colors for layers 0 to 31
- static const EDA_COLOR_T color_default[] = {
- GREEN, BLUE, LIGHTGRAY, MAGENTA,
- RED, DARKGREEN, BROWN, MAGENTA,
- LIGHTGRAY, BLUE, GREEN, CYAN,
- LIGHTRED, LIGHTMAGENTA, YELLOW, RED,
- BLUE, BROWN, LIGHTCYAN, RED,
- MAGENTA, CYAN, BROWN, MAGENTA,
- LIGHTGRAY, BLUE, GREEN, DARKCYAN,
- YELLOW, LIGHTMAGENTA, YELLOW, LIGHTGRAY,
+ static const COLOR4D color_default[] = {
+ COLOR4D( GREEN ), COLOR4D( BLUE ), COLOR4D( LIGHTGRAY ), COLOR4D( MAGENTA ),
+ COLOR4D( RED ), COLOR4D( DARKGREEN ), COLOR4D( BROWN ), COLOR4D( MAGENTA ),
+ COLOR4D( LIGHTGRAY ), COLOR4D( BLUE ), COLOR4D( GREEN ), COLOR4D( CYAN ),
+ COLOR4D( LIGHTRED ), COLOR4D( LIGHTMAGENTA ), COLOR4D( YELLOW ), COLOR4D( RED ),
+ COLOR4D( BLUE ), COLOR4D( BROWN ), COLOR4D( LIGHTCYAN ), COLOR4D( RED ),
+ COLOR4D( MAGENTA ), COLOR4D( CYAN ), COLOR4D( BROWN ), COLOR4D( MAGENTA ),
+ COLOR4D( LIGHTGRAY ), COLOR4D( BLUE ), COLOR4D( GREEN ), COLOR4D( DARKCYAN ),
+ COLOR4D( YELLOW ), COLOR4D( LIGHTMAGENTA ), COLOR4D( YELLOW ), COLOR4D( LIGHTGRAY ),
};
// List of keywords used as identifiers in config.
@@ -134,7 +134,7 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
for( unsigned i = 0; i < DIM(keys); ++i )
{
- EDA_COLOR_T* prm = &g_ColorsSettings.m_LayersColors[i];
+ COLOR4D* prm = &g_ColorsSettings.m_LayersColors[i];
PARAM_CFG_SETCOLOR* prm_entry =
new PARAM_CFG_SETCOLOR( true, keys[i], prm, color_default[i] );
diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp
index ff537cff92..1e6795f2b0 100644
--- a/gerbview/gerbview_frame.cpp
+++ b/gerbview/gerbview_frame.cpp
@@ -607,9 +607,9 @@ bool GERBVIEW_FRAME::IsLayerVisible( int aLayer ) const
}
-EDA_COLOR_T GERBVIEW_FRAME::GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const
+COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const
{
- EDA_COLOR_T color = UNSPECIFIED_COLOR;
+ COLOR4D color = UNSPECIFIED_COLOR4D;
switch( aItemIdVisible )
{
@@ -639,7 +639,7 @@ void GERBVIEW_FRAME::SetGridVisibility( bool aVisible )
void GERBVIEW_FRAME::SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible,
- EDA_COLOR_T aColor )
+ COLOR4D aColor )
{
switch( aItemIdVisible )
{
@@ -659,7 +659,7 @@ void GERBVIEW_FRAME::SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible,
}
}
-EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const
+COLOR4D GERBVIEW_FRAME::GetNegativeItemsColor() const
{
if( IsElementVisible( NEGATIVE_OBJECTS_VISIBLE ) )
return GetVisibleElementColor( NEGATIVE_OBJECTS_VISIBLE );
@@ -668,13 +668,13 @@ EDA_COLOR_T GERBVIEW_FRAME::GetNegativeItemsColor() const
}
-EDA_COLOR_T GERBVIEW_FRAME::GetLayerColor( int aLayer ) const
+COLOR4D GERBVIEW_FRAME::GetLayerColor( int aLayer ) const
{
return m_colorsSettings->GetLayerColor( aLayer );
}
-void GERBVIEW_FRAME::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
+void GERBVIEW_FRAME::SetLayerColor( int aLayer, COLOR4D aColor )
{
m_colorsSettings->SetLayerColor( aLayer, aColor );
}
diff --git a/gerbview/gerbview_frame.h b/gerbview/gerbview_frame.h
index 4635b62113..8646ff8fcb 100644
--- a/gerbview/gerbview_frame.h
+++ b/gerbview/gerbview_frame.h
@@ -334,21 +334,21 @@ public:
* Function GetVisibleElementColor
* returns the color of a gerber visible element.
*/
- EDA_COLOR_T GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const;
+ COLOR4D GetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible ) const;
- void SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible, EDA_COLOR_T aColor );
+ void SetVisibleElementColor( GERBER_VISIBLE_ID aItemIdVisible, COLOR4D aColor );
/**
* Function GetLayerColor
* gets a layer color for any valid layer.
*/
- EDA_COLOR_T GetLayerColor( int aLayer ) const;
+ COLOR4D GetLayerColor( int aLayer ) const;
/**
* Function SetLayerColor
* changes a layer color for any valid layer.
*/
- void SetLayerColor( int aLayer, EDA_COLOR_T aColor );
+ void SetLayerColor( int aLayer, COLOR4D aColor );
/**
* Function GetNegativeItemsColor
@@ -356,7 +356,7 @@ public:
* This is usually the background color, but can be an other color
* in order to see negative objects
*/
- EDA_COLOR_T GetNegativeItemsColor() const;
+ COLOR4D GetNegativeItemsColor() const;
/**
* Function DisplayLinesSolidMode
diff --git a/gerbview/printout_control.cpp b/gerbview/printout_control.cpp
index 60befcaf92..21a758c2c1 100644
--- a/gerbview/printout_control.cpp
+++ b/gerbview/printout_control.cpp
@@ -237,7 +237,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage( const wxString& aLayerName,
panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) );
screen->m_IsPrinting = true;
- EDA_COLOR_T bg_color = m_Parent->GetDrawBgColor();
+ COLOR4D bg_color = m_Parent->GetDrawBgColor();
// Print frame reference, if requested, before printing draw layers
if( m_PrintParams.m_Print_Black_and_White )
diff --git a/include/basic_gal.h b/include/basic_gal.h
index 0acf079806..e3054b481d 100644
--- a/include/basic_gal.h
+++ b/include/basic_gal.h
@@ -57,7 +57,7 @@ class BASIC_GAL: public KIGFX::GAL
{
public:
wxDC* m_DC;
- EDA_COLOR_T m_Color;
+ COLOR4D m_Color;
private:
TRANSFORM_PRM m_transform;
diff --git a/include/block_commande.h b/include/block_commande.h
index 8c7d5e8661..8c85aad325 100644
--- a/include/block_commande.h
+++ b/include/block_commande.h
@@ -75,7 +75,7 @@ class BLOCK_SELECTOR : public EDA_RECT
BLOCK_STATE_T m_state; //< State (enum BLOCK_STATE_T) of the block.
BLOCK_COMMAND_T m_command; //< Command (enum BLOCK_COMMAND_T) operation.
PICKED_ITEMS_LIST m_items; //< List of items selected in this block.
- EDA_COLOR_T m_color; //< Block Color (for drawings).
+ COLOR4D m_color; //< Block Color (for drawings).
wxPoint m_moveVector; //< Move distance to move the block.
wxPoint m_lastCursorPosition; //< Last Mouse position in block command
//< last cursor position in move commands
@@ -93,9 +93,9 @@ public:
BLOCK_COMMAND_T GetCommand() const { return m_command; }
- void SetColor( EDA_COLOR_T aColor ) { m_color = aColor; }
+ void SetColor( COLOR4D aColor ) { m_color = aColor; }
- EDA_COLOR_T GetColor() const { return m_color; }
+ COLOR4D GetColor() const { return m_color; }
/**
* Function SetLastCursorPosition
@@ -128,7 +128,7 @@ public:
wxDC* aDC,
const wxPoint& aOffset,
GR_DRAWMODE aDrawMode,
- EDA_COLOR_T aColor );
+ COLOR4D aColor );
/**
* Function PushItem
diff --git a/include/class_bitmap_base.h b/include/class_bitmap_base.h
index a9c13321af..5863160adc 100644
--- a/include/class_bitmap_base.h
+++ b/include/class_bitmap_base.h
@@ -222,7 +222,7 @@ public:
* @param aDefaultPensize = the pen size used to plot the rectangle when bitmap is not supported
*/
void PlotImage( PLOTTER* aPlotter, const wxPoint& aPos,
- EDA_COLOR_T aDefaultColor, int aDefaultPensize );
+ COLOR4D aDefaultColor, int aDefaultPensize );
};
diff --git a/include/class_colors_design_settings.h b/include/class_colors_design_settings.h
index 601526dec6..1ba91e4a2d 100644
--- a/include/class_colors_design_settings.h
+++ b/include/class_colors_design_settings.h
@@ -29,9 +29,10 @@
#ifndef COLORS_DESIGN_SETTING_H
#define COLORS_DESIGN_SETTING_H
-#include // definition of EDA_COLOR_T
+#include
#include
+using KIGFX::COLOR4D;
/**
* Class COLORS_DESIGN_SETTINGS
@@ -43,10 +44,10 @@ public:
// Color options for screen display of the Printed Board and schematic:
// Common to Eeschema, Pcbnew, GerbView
- EDA_COLOR_T m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items)
+ COLOR4D m_LayersColors[LAYER_ID_COUNT]; ///< Layer colors (tracks and graphic items)
// Common to Eeschema, Pcbnew
- EDA_COLOR_T m_ItemsColors[32]; ///< All others items but layers
+ COLOR4D m_ItemsColors[32]; ///< All others items but layers
public:
COLORS_DESIGN_SETTINGS();
@@ -56,35 +57,35 @@ public:
* @return the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
- EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
+ COLOR4D GetLayerColor( LAYER_NUM aLayer ) const;
/**
* Function SetLayerColor
* sets the color for aLayer which is one of the layer indices given
* in pcbstruct.h or in schematic
*/
- void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor );
+ void SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor );
/**
* Function GetItemColor
* @return the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
- EDA_COLOR_T GetItemColor( int aItemIdx ) const;
+ COLOR4D GetItemColor( int aItemIdx ) const;
/**
* Function SetItemColor
* sets the color for an item which is one of the item indices given
* in pcbstruct.h, enum PCB_VISIBLE or in schematic
*/
- void SetItemColor( int aItemIdx, EDA_COLOR_T aColor );
+ void SetItemColor( int aItemIdx, COLOR4D aColor );
/**
* Function SetAllColorsAs
* sets alls colors to aColor
* Usefull to create a monochrome color selection for printing purpose
*/
- void SetAllColorsAs( EDA_COLOR_T aColor);
+ void SetAllColorsAs( COLOR4D aColor );
};
#endif // COLORS_DESIGN_SETTING_H
diff --git a/include/class_drawpanel.h b/include/class_drawpanel.h
index 4aa5affe96..2c35f8de0f 100644
--- a/include/class_drawpanel.h
+++ b/include/class_drawpanel.h
@@ -31,7 +31,6 @@
#ifndef PANEL_WXSTRUCT_H
#define PANEL_WXSTRUCT_H
-#include
#include
#include
@@ -368,7 +367,7 @@ public:
* @param aDC - the device context to draw the cursor
* @param aColor - the color to draw the cursor
*/
- void DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor = WHITE );
+ void DrawCrossHair( wxDC* aDC, COLOR4D aColor = COLOR4D_WHITE );
// Hide the cross hair.
void CrossHairOff( wxDC* DC );
diff --git a/include/class_layer_box_selector.h b/include/class_layer_box_selector.h
index 1f07df7554..d2edc1db81 100644
--- a/include/class_layer_box_selector.h
+++ b/include/class_layer_box_selector.h
@@ -26,10 +26,11 @@
#define CLASS_LAYER_BOX_SELECTOR_H 1
#include
-#include // EDA_COLOR_T definition
+#include
#include
struct EDA_HOTKEY_CONFIG;
+using KIGFX::COLOR4D;
/* Basic class to build a layer list.
* this is an basic abstract class to build a layer list selector.
@@ -49,7 +50,7 @@ public:
// Returns a color index from the layer id
// Virtual function because GerbView uses its own functions in a derived class
- virtual EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const = 0;
+ virtual COLOR4D GetLayerColor( LAYER_NUM aLayer ) const = 0;
// Returns the name of the layer id
// Virtual pure function because GerbView uses its own functions in a derived class
diff --git a/include/class_marker_base.h b/include/class_marker_base.h
index b91de15e85..5903eae959 100644
--- a/include/class_marker_base.h
+++ b/include/class_marker_base.h
@@ -55,7 +55,7 @@ public:
protected:
TYPEMARKER m_MarkerType; ///< The type of marker (useful to filter markers)
MARKER_SEVERITY m_ErrorLevel; ///< Specify the severity of the error
- EDA_COLOR_T m_Color; ///< color
+ COLOR4D m_Color; ///< color
EDA_RECT m_ShapeBoundingBox; ///< Bounding box of the graphic symbol, relative
///< to the position of the shape, used for Hit
///< Tests
@@ -122,7 +122,7 @@ public:
* Function SetColor
* Set the color of this marker
*/
- void SetColor( EDA_COLOR_T aColor )
+ void SetColor( COLOR4D aColor )
{
m_Color = aColor;
}
diff --git a/include/class_worksheet_dataitem.h b/include/class_worksheet_dataitem.h
index bbd289c2c0..87fb6eb9fc 100644
--- a/include/class_worksheet_dataitem.h
+++ b/include/class_worksheet_dataitem.h
@@ -105,44 +105,44 @@ public:
};
protected:
- WS_ItemType m_type;
- int m_flags;
+ WS_ItemType m_type;
+ int m_flags;
public:
- wxString m_Name; // a item name used in page layout
+ wxString m_Name; // a item name used in page layout
// editor to identify items
- wxString m_Info; // a comment, only useful in page
+ wxString m_Info; // a comment, only useful in page
// layout editor
- POINT_COORD m_Pos;
- POINT_COORD m_End;
- double m_LineWidth;
- int m_RepeatCount; // repeat count for duplicate items
- DPOINT m_IncrementVector; // For duplicate items: move vector
+ POINT_COORD m_Pos;
+ POINT_COORD m_End;
+ double m_LineWidth;
+ int m_RepeatCount; // repeat count for duplicate items
+ DPOINT m_IncrementVector; // For duplicate items: move vector
// for position increment
- int m_IncrementLabel;
+ int m_IncrementLabel;
// These variables are static, because these values are common to all
// instances of WORKSHEET_DATAITEM.
// They are default or common values.
- static double m_WSunits2Iu; // conversion factor between
+ static double m_WSunits2Iu; // conversion factor between
// ws units (mils) and draw/plot units
- static DPOINT m_RB_Corner; // cordinates of the right bottom corner
+ static DPOINT m_RB_Corner; // cordinates of the right bottom corner
// (ws units)
- static DPOINT m_LT_Corner; // cordinates of the left top corner
+ static DPOINT m_LT_Corner; // cordinates of the left top corner
// (ws units)
- static double m_DefaultLineWidth; // Default line width,
+ static double m_DefaultLineWidth; // Default line width,
// when not defined inside a line
// or a rect
- static DSIZE m_DefaultTextSize; // Default text size,
+ static DSIZE m_DefaultTextSize; // Default text size,
// when not defined inside a tbtext
- static double m_DefaultTextThickness;// Default text thickness,
+ static double m_DefaultTextThickness; // Default text thickness,
// when not defined inside a tbtext
- static bool m_SpecialMode; // Used in page layout editor
+ static bool m_SpecialMode; // Used in page layout editor
// When set to true, base texts
// instead of full texts are displayed
- static EDA_COLOR_T m_Color; // the default color to draw items
- static EDA_COLOR_T m_AltColor; // an alternate color to draw items
- static EDA_COLOR_T m_SelectedColor; // the color to draw selected items
+ static COLOR4D m_Color; // the default color to draw items
+ static COLOR4D m_AltColor; // an alternate color to draw items
+ static COLOR4D m_SelectedColor; // the color to draw selected items
// (used in page layout editor
@@ -279,7 +279,7 @@ public:
bool UseAltColor() {return m_flags & USE_ALT_COLOR; }
- EDA_COLOR_T GetItemColor()
+ COLOR4D GetItemColor()
{
if( IsSelected() )
return m_SelectedColor;
diff --git a/include/colors.h b/include/colors.h
index 6b58bb7c98..67a9e7388c 100644
--- a/include/colors.h
+++ b/include/colors.h
@@ -22,6 +22,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+/**
+ * NOTE: EDA_COLOR_T is deprecated and is kept around for compatibility with
+ * legacy canvas. Once there is no need for legacy support, the color
+ * table g_ColorRefs in colors.cpp can be re-written in COLOR4D and this
+ * file can go away.
+ *
+ * Please use COLOR4D instead of including this file.
+ */
+
#ifndef COLORS_H_
#define COLORS_H_
diff --git a/include/common.h b/include/common.h
index dbd4dd6834..a083de89a7 100644
--- a/include/common.h
+++ b/include/common.h
@@ -40,7 +40,7 @@
#include
#include
-#include
+#include
#include
@@ -181,7 +181,7 @@ enum EDA_UNITS_T {
extern EDA_UNITS_T g_UserUnit; ///< display units
/// Draw color for moving objects.
-extern EDA_COLOR_T g_GhostColor;
+extern KIGFX::COLOR4D g_GhostColor;
/**
diff --git a/include/config_params.h b/include/config_params.h
index 9d4dad147c..c01f867631 100644
--- a/include/config_params.h
+++ b/include/config_params.h
@@ -34,9 +34,11 @@
#include
#include
#include
-#include
+#include
#include
+using KIGFX::COLOR4D;
+
/// Names of sub sections where to store project info in *.pro project config files
#define GROUP_PCB wxT( "/pcbnew" ) /// parameters for Pcbnew/Modedit
#define GROUP_SCH wxT( "/eeschema" ) /// library list and lib paths list
@@ -183,14 +185,14 @@ public:
class PARAM_CFG_SETCOLOR : public PARAM_CFG_BASE
{
public:
- EDA_COLOR_T* m_Pt_param; ///< Pointer to the parameter value
- EDA_COLOR_T m_Default; ///< The default value of the parameter
+ COLOR4D* m_Pt_param; ///< Pointer to the parameter value
+ COLOR4D m_Default; ///< The default value of the parameter
public:
- PARAM_CFG_SETCOLOR( const wxString& ident, EDA_COLOR_T* ptparam,
- EDA_COLOR_T default_val, const wxChar* group = NULL );
- PARAM_CFG_SETCOLOR( bool Insetup, const wxString& ident, EDA_COLOR_T* ptparam,
- EDA_COLOR_T default_val, const wxChar* group = NULL );
+ PARAM_CFG_SETCOLOR( const wxString& ident, COLOR4D* ptparam,
+ COLOR4D default_val, const wxChar* group = NULL );
+ PARAM_CFG_SETCOLOR( bool Insetup, const wxString& ident, COLOR4D* ptparam,
+ COLOR4D default_val, const wxChar* group = NULL );
virtual void ReadParam( wxConfigBase* aConfig ) const override;
virtual void SaveParam( wxConfigBase* aConfig ) const override;
diff --git a/include/draw_frame.h b/include/draw_frame.h
index e4a69503ef..51eae83515 100644
--- a/include/draw_frame.h
+++ b/include/draw_frame.h
@@ -29,10 +29,14 @@
#include
#include
#include
+#include
+#include
class wxSingleInstanceChecker;
class EDA_HOTKEY;
+using KIGFX::COLOR4D;
+
namespace KIGFX
{
class GAL_DISPLAY_OPTIONS;
@@ -75,8 +79,8 @@ protected:
// a wxCommand ID = ID_POPUP_GRID_LEVEL_1000.
bool m_drawGrid; // hide/Show grid
bool m_showPageLimits; ///< true to display the page limits
- EDA_COLOR_T m_gridColor; // Grid color
- EDA_COLOR_T m_drawBgColor; ///< the background color of the draw canvas
+ COLOR4D m_gridColor; ///< Grid color
+ COLOR4D m_drawBgColor; ///< the background color of the draw canvas
///< BLACK for Pcbnew, BLACK or WHITE for eeschema
double m_zoomLevelCoeff; ///< a suitable value to convert the internal zoom scaling factor
// to a zoom level value which rougly gives 1.0 when the board/schematic
@@ -282,14 +286,14 @@ public:
// the background color of the draw canvas:
// Virtual because some frames can have a specific way to get/set the bg color
/**
- * @return the EDA_COLOR_T for the canvas background
+ * @return the COLOR4D for the canvas background
*/
- virtual EDA_COLOR_T GetDrawBgColor() const { return m_drawBgColor; }
+ virtual COLOR4D GetDrawBgColor() const { return m_drawBgColor; }
/**
- * @param aColor: the EDA_COLOR_T for the canvas background
+ * @param aColor: the COLOR4D for the canvas background
*/
- virtual void SetDrawBgColor( EDA_COLOR_T aColor) { m_drawBgColor= aColor ; }
+ virtual void SetDrawBgColor( COLOR4D aColor) { m_drawBgColor= aColor ; }
int GetCursorShape() const { return m_cursorShape; }
@@ -437,7 +441,7 @@ public:
* Function GetGridColor() , virtual
* @return the color of the grid
*/
- virtual EDA_COLOR_T GetGridColor() const
+ virtual COLOR4D GetGridColor() const
{
return m_gridColor;
}
@@ -446,7 +450,7 @@ public:
* Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
- virtual void SetGridColor( EDA_COLOR_T aColor )
+ virtual void SetGridColor( COLOR4D aColor )
{
m_gridColor = aColor;
}
@@ -718,7 +722,7 @@ public:
* @param pad - Number of spaces to pad between messages (default = 4).
*/
void AppendMsgPanel( const wxString& textUpper, const wxString& textLower,
- EDA_COLOR_T color, int pad = 6 );
+ COLOR4D color, int pad = 6 );
/**
* Clear all messages from the message panel.
diff --git a/include/drawtxt.h b/include/drawtxt.h
index faf61cf120..c87873cfd5 100644
--- a/include/drawtxt.h
+++ b/include/drawtxt.h
@@ -86,7 +86,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
* @param aClipBox = the clipping rect, or NULL if no clipping
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
* @param aPos = text position (according to h_justify, v_justify)
- * @param aColor (enum EDA_COLOR_T) = text color
+ * @param aColor (COLOR4D) = text color
* @param aText = text to draw
* @param aOrient = angle in 0.1 degree
* @param aSize = text size (size.x or size.y can be < 0 for mirrored texts)
@@ -105,7 +105,7 @@ int GraphicTextWidth( const wxString& aText, const wxSize& aSize, bool italic, b
void DrawGraphicText( EDA_RECT* aClipBox,
wxDC * aDC,
const wxPoint &aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString &aText,
double aOrient,
const wxSize &aSize,
@@ -127,9 +127,9 @@ void DrawGraphicText( EDA_RECT* aClipBox,
void DrawGraphicHaloText( EDA_RECT* aClipBox,
wxDC * aDC,
const wxPoint &aPos,
- enum EDA_COLOR_T aBgColor,
- enum EDA_COLOR_T aColor1,
- enum EDA_COLOR_T aColor2,
+ const COLOR4D aBgColor,
+ COLOR4D aColor1,
+ COLOR4D aColor2,
const wxString &aText,
double aOrient,
const wxSize &aSize,
diff --git a/include/eda_text.h b/include/eda_text.h
index 45804846f2..fafda2e633 100644
--- a/include/eda_text.h
+++ b/include/eda_text.h
@@ -238,12 +238,12 @@ public:
* @param aColor = text color
* @param aDrawMode = GR_OR, GR_XOR.., -1 to use the current mode.
* @param aDisplay_mode = FILLED or SKETCH
- * @param aAnchor_color = anchor color ( UNSPECIFIED_COLOR = do not draw anchor ).
+ * @param aAnchor_color = anchor color ( UNSPECIFIED_COLOR4D = do not draw anchor ).
*/
void Draw( EDA_RECT* aClipBox, wxDC* aDC,
- const wxPoint& aOffset, EDA_COLOR_T aColor,
+ const wxPoint& aOffset, COLOR4D aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aDisplay_mode = FILLED,
- EDA_COLOR_T aAnchor_color = EDA_COLOR_T(UNSPECIFIED_COLOR) );
+ COLOR4D aAnchor_color = UNSPECIFIED_COLOR4D );
/**
* Convert the text shape to a list of segment
@@ -362,7 +362,7 @@ private:
* @param aPos = the position of this line ).
*/
void drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
- const wxPoint& aOffset, EDA_COLOR_T aColor,
+ const wxPoint& aOffset, COLOR4D aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
const wxString& aText, const wxPoint& aPos );
diff --git a/include/gal/color4d.h b/include/gal/color4d.h
index 46ae899745..ba5ed34df1 100644
--- a/include/gal/color4d.h
+++ b/include/gal/color4d.h
@@ -77,6 +77,65 @@ public:
* @param aColor is the color type used by wxWidgets.
*/
COLOR4D( const wxColour& aColor );
+
+ /**
+ * Function SetFromWxString
+ * Sets color values by parsing a string using wxColour::Set()
+ *
+ * @param aColorString is a color string that wxColour can understand
+ * @return true if color was set successfully
+ */
+ bool SetFromWxString( const wxString& aColorString );
+
+ wxString ToWxString( long flags );
+
+ wxColour ToColour() const
+ {
+ wxColour colour( r * 255, g * 255, b * 255, a * 255 );
+ return colour;
+ }
+
+ /**
+ * Function LegacyMix()
+ * Mixes this COLOR4D with an input COLOR4D using the OR-mixing of legacy canvas.
+ *
+ * Can be removed once legacy canvas is removed.
+ * Depends on wxColour for simplicity, but could be re-written to avoid
+ * this dependency if desired.
+ *
+ * @param aColor The color to mix with this one
+ */
+ COLOR4D LegacyMix( COLOR4D aColor ) const;
+
+ /**
+ * Function SetToLegacyHighlightColor()
+ * Sets the color to the "light" version of the nearest matching
+ * legacy color (see g_ColorRefs in colors.cpp).
+ */
+ COLOR4D& SetToLegacyHighlightColor();
+
+ /**
+ * Function SetToNearestLegacyColor()
+ * Sets the color to the nearest matching
+ * legacy color (see g_ColorRefs in colors.cpp).
+ */
+ COLOR4D& SetToNearestLegacyColor();
+
+ /**
+ * Packs the color into an unsigned int for compatibility with legacy canvas.
+ * Note that this is a lossy downsampling and also that the alpha channel is lost.
+ */
+ unsigned int ToU32() const;
+
+ /**
+ * Unpacks from a unsigned int in the legacy EDA_COLOR_T format.
+ */
+ void FromU32( unsigned int aPackedColor );
+
+ /**
+ * Determines the "nearest" EDA_COLOR_T according to ColorFindNearest
+ */
+ static EDA_COLOR_T GetNearestLegacyColor( COLOR4D &aColor );
#endif /* WX_COMPATIBLITY */
/**
@@ -205,18 +264,27 @@ public:
*/
void FromHSV( double aInH, double aInS, double aInV );
- /// @brief Equality operator, are two colors equal
- const bool operator==( const COLOR4D& aColor );
-
- /// @brief Not equality operator, are two colors not equal
- const bool operator!=( const COLOR4D& aColor );
-
// Color components: red, green, blue, alpha
double r; ///< Red component
double g; ///< Green component
double b; ///< Blue component
double a; ///< Alpha component
};
+
+/// @brief Equality operator, are two colors equal
+const bool operator==( const COLOR4D& lhs, const COLOR4D& rhs );
+
+/// @brief Not equality operator, are two colors not equal
+const bool operator!=( const COLOR4D& lhs, const COLOR4D& rhs );
+
} // namespace KIGFX
+/// For legacy support; used as a value to indicate color hasn't been set yet
+#define UNSPECIFIED_COLOR4D ( KIGFX::COLOR4D( 0, 0, 0, 0 ) )
+
+/// Declare a few color shortcuts that are used for comparisons frequently
+#define COLOR4D_WHITE ( KIGFX::COLOR4D( 1, 1, 1, 1 ) )
+#define COLOR4D_BLACK ( KIGFX::COLOR4D( 0, 0, 0, 1 ) )
+
+
#endif /* COLOR4D_H_ */
diff --git a/include/gr_basic.h b/include/gr_basic.h
index c68ea5a71a..1e4d513d64 100644
--- a/include/gr_basic.h
+++ b/include/gr_basic.h
@@ -30,10 +30,12 @@
#ifndef GR_BASIC
#define GR_BASIC
-#include
+#include
#include
class EDA_RECT;
+using KIGFX::COLOR4D;
+
/// Drawmode. Compositing mode plus a flag or two
enum GR_DRAWMODE {
@@ -94,8 +96,8 @@ class EDA_DRAW_PANEL;
void GRSetDrawMode( wxDC* DC, GR_DRAWMODE mode );
GR_DRAWMODE GRGetDrawMode( wxDC* DC );
void GRResetPenAndBrush( wxDC* DC );
-void GRSetColorPen( wxDC* DC, EDA_COLOR_T Color, int width = 1, wxPenStyle stype = wxPENSTYLE_SOLID );
-void GRSetBrush( wxDC* DC, EDA_COLOR_T Color, bool fill = false );
+void GRSetColorPen( wxDC* DC, COLOR4D Color, int width = 1, wxPenStyle stype = wxPENSTYLE_SOLID );
+void GRSetBrush( wxDC* DC, COLOR4D Color, bool fill = false );
/**
* Function GRForceBlackPen
@@ -110,24 +112,24 @@ void GRForceBlackPen( bool flagforce );
bool GetGRForceBlackPenState( void );
void GRLine( EDA_RECT* aClipBox, wxDC* aDC,
- wxPoint aStart, wxPoint aEnd, int aWidth, EDA_COLOR_T aColor );
+ wxPoint aStart, wxPoint aEnd, int aWidth, COLOR4D aColor );
void GRLine( EDA_RECT* ClipBox, wxDC* DC,
- int x1, int y1, int x2, int y2, int width, EDA_COLOR_T Color );
+ int x1, int y1, int x2, int y2, int width, COLOR4D Color );
void GRMixedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
- int width, EDA_COLOR_T Color );
+ int width, COLOR4D Color );
void GRDashedLine( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
- int width, EDA_COLOR_T Color );
+ int width, COLOR4D Color );
void GRMoveTo( int x, int y );
void GRLineTo( EDA_RECT* ClipBox, wxDC* DC,
- int x, int y, int width, EDA_COLOR_T Color );
+ int x, int y, int width, COLOR4D Color );
void GRPoly( EDA_RECT* ClipBox, wxDC* DC, int n, wxPoint Points[], bool Fill,
- int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
+ int width, COLOR4D Color, COLOR4D BgColor );
void GRBezier( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
- int x3, int y3, int width, EDA_COLOR_T Color );
+ int x3, int y3, int width, COLOR4D Color );
void GRBezier( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
- int x3, int y3, int x4, int y4, int width, EDA_COLOR_T Color );
+ int x3, int y3, int x4, int y4, int width, COLOR4D Color );
/**
* Function GRClosedPoly
@@ -138,7 +140,7 @@ void GRBezier( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
* @param aPointCount the number of points in the array \a aPoints.
* @param aPoints The points to draw.
* @param doFill true if polygon is to be filled, else false and only the boundary is drawn.
- * @param aPenColor the color index of the border.
+ * @param aPenColor the color of the border.
* @param aFillColor the fill color of the polygon's interior.
*/
void GRClosedPoly( EDA_RECT* ClipBox,
@@ -146,8 +148,8 @@ void GRClosedPoly( EDA_RECT* ClipBox,
int aPointCount,
wxPoint aPoints[],
bool doFill,
- EDA_COLOR_T aPenColor,
- EDA_COLOR_T aFillColor );
+ COLOR4D aPenColor,
+ COLOR4D aFillColor );
// @todo could make these 2 closed polygons calls a single function and default
// the aPenWidth argument
@@ -162,7 +164,7 @@ void GRClosedPoly( EDA_RECT* ClipBox,
* @param aPoints the points to draw.
* @param doFill true if polygon is to be filled, else false and only the boundary is drawn.
* @param aPenWidth is the width of the pen to use on the perimeter, can be zero.
- * @param aPenColor the color index of the border.
+ * @param aPenColor the color of the border.
* @param aFillColor the fill color of the polygon's interior.
*/
void GRClosedPoly( EDA_RECT* ClipBox,
@@ -171,8 +173,8 @@ void GRClosedPoly( EDA_RECT* ClipBox,
wxPoint aPoints[],
bool doFill,
int aPenWidth,
- EDA_COLOR_T aPenColor,
- EDA_COLOR_T aFillColor );
+ COLOR4D aPenColor,
+ COLOR4D aFillColor );
/**
@@ -185,59 +187,59 @@ void GRClosedPoly( EDA_RECT* ClipBox,
* @param x The x coordinate in user space of the center of the circle.
* @param y The y coordinate in user space of the center of the circle.
* @param aRadius is the radius of the circle.
- * @param aColor is an index into our color table of RGB colors.
- * @see EDA_COLOR_T and colors.h
+ * @param aColor is the color to draw
+ * @see COLOR4D
*/
-void GRCircle( EDA_RECT* ClipBox, wxDC* aDC, int x, int y, int aRadius, EDA_COLOR_T aColor );
-void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, EDA_COLOR_T Color );
+void GRCircle( EDA_RECT* ClipBox, wxDC* aDC, int x, int y, int aRadius, COLOR4D aColor );
+void GRCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width, COLOR4D Color );
void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width,
- EDA_COLOR_T Color, EDA_COLOR_T BgColor );
-void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, EDA_COLOR_T aColor );
-void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth, EDA_COLOR_T aColor );
+ COLOR4D Color, COLOR4D BgColor );
+void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, COLOR4D aColor );
+void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth, COLOR4D aColor );
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
- double EndAngle, int r, EDA_COLOR_T Color );
+ double EndAngle, int r, COLOR4D Color );
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
- double EndAngle, int r, int width, EDA_COLOR_T Color );
+ double EndAngle, int r, int width, COLOR4D Color );
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
- int xc, int yc, EDA_COLOR_T Color );
+ int xc, int yc, COLOR4D Color );
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
- int xc, int yc, int width, EDA_COLOR_T Color );
+ int xc, int yc, int width, COLOR4D Color );
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
- wxPoint aCenter, int aWidth, EDA_COLOR_T aColor );
+ wxPoint aCenter, int aWidth, COLOR4D aColor );
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y,
- double StAngle, double EndAngle, int r, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
+ double StAngle, double EndAngle, int r, COLOR4D Color, COLOR4D BgColor );
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
- double EndAngle, int r, int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
-void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, EDA_COLOR_T Color );
+ double EndAngle, int r, int width, COLOR4D Color, COLOR4D BgColor );
+void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, COLOR4D Color );
void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
- int width, EDA_COLOR_T Color );
+ int width, COLOR4D Color );
void GRFilledSegment( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
- int aWidth, EDA_COLOR_T aColor );
+ int aWidth, COLOR4D aColor );
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
- int width, int aPenSize, EDA_COLOR_T Color );
+ int width, int aPenSize, COLOR4D Color );
void GRCSegm( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
- int aWidth, EDA_COLOR_T aColor );
+ int aWidth, COLOR4D aColor );
-void GRSetColor( EDA_COLOR_T Color );
+void GRSetColor( COLOR4D Color );
void GRSetDefaultPalette();
-EDA_COLOR_T GRGetColor();
-void GRPutPixel( EDA_RECT* ClipBox, wxDC* DC, int x, int y, EDA_COLOR_T color );
+COLOR4D GRGetColor();
+void GRPutPixel( EDA_RECT* ClipBox, wxDC* DC, int x, int y, COLOR4D color );
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
- int x2, int y2, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
+ int x2, int y2, COLOR4D Color, COLOR4D BgColor );
void GRFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
- int x2, int y2, int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
-void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, EDA_COLOR_T Color );
-void GRRect( EDA_RECT* ClipBox, wxDC* DC,const EDA_RECT& aRect, int aWidth, EDA_COLOR_T Color );
+ int x2, int y2, int width, COLOR4D Color, COLOR4D BgColor );
+void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, COLOR4D Color );
+void GRRect( EDA_RECT* ClipBox, wxDC* DC,const EDA_RECT& aRect, int aWidth, COLOR4D Color );
void GRRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
- int x2, int y2, int width, EDA_COLOR_T Color );
+ int x2, int y2, int width, COLOR4D Color );
void GRRectPs( EDA_RECT* aClipBox, wxDC* aDC,const EDA_RECT& aRect,
- int aWidth, EDA_COLOR_T aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID );
+ int aWidth, COLOR4D aColor, wxPenStyle aStyle = wxPENSTYLE_SOLID );
void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
- int x2, int y2, int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
+ int x2, int y2, int width, COLOR4D Color, COLOR4D BgColor );
/**
* Function GRLineArray
@@ -246,13 +248,13 @@ void GRSFilledRect( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1,
* @param aDC = the device context into which drawing should occur.
* @param aLines = a list of pair of coordinate in user space: a pair for each line.
* @param aWidth = the width of each line.
- * @param aColor = an index into our color table of RGB colors.
- * @see EDA_COLOR_T and colors.h
+ * @param aColor = the color of the lines
+ * @see COLOR4D
*/
void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC,std::vector& aLines,
- int aWidth, EDA_COLOR_T aColor );
+ int aWidth, COLOR4D aColor );
void GRDrawAnchor( EDA_RECT* aClipBox, wxDC *aDC, int x, int y, int aSize,
- EDA_COLOR_T aColor );
+ COLOR4D aColor );
#endif /* define GR_BASIC */
diff --git a/include/msgpanel.h b/include/msgpanel.h
index 31478f28e5..f4dbe13d65 100644
--- a/include/msgpanel.h
+++ b/include/msgpanel.h
@@ -32,12 +32,13 @@
#define _MSGPANEL_H_
-#include
+#include
#include
#include
+using KIGFX::COLOR4D;
#define MSG_PANEL_DEFAULT_PAD 6 ///< The default number of spaces between each text string.
@@ -56,13 +57,13 @@ class MSG_PANEL_ITEM
int m_LowerY;
wxString m_UpperText;
wxString m_LowerText;
- EDA_COLOR_T m_Color;
+ COLOR4D m_Color;
int m_Pad;
friend class EDA_MSG_PANEL;
public:
- MSG_PANEL_ITEM( const wxString& aUpperText, const wxString& aLowerText, EDA_COLOR_T aColor,
+ MSG_PANEL_ITEM( const wxString& aUpperText, const wxString& aLowerText, COLOR4D aColor,
int aPad = MSG_PANEL_DEFAULT_PAD ) :
m_UpperText( aUpperText ),
m_LowerText( aLowerText ),
@@ -81,7 +82,7 @@ public:
m_X = 0;
m_UpperY = 0;
m_LowerY = 0;
- m_Color = UNSPECIFIED_COLOR;
+ m_Color = UNSPECIFIED_COLOR4D;
}
void SetUpperText( const wxString& aUpperText ) { m_UpperText = aUpperText; }
@@ -90,8 +91,8 @@ public:
void SetLowerText( const wxString& aLowerText ) { m_LowerText = aLowerText; }
const wxString& GetLowerText() const { return m_LowerText; }
- void SetColor( EDA_COLOR_T aColor ) { m_Color = aColor; }
- EDA_COLOR_T GetColor() const { return m_Color; }
+ void SetColor( COLOR4D aColor ) { m_Color = aColor; }
+ COLOR4D GetColor() const { return m_Color; }
void SetPadding( int aPad ) { m_Pad = aPad; }
int GetPadding() const { return m_Pad; }
@@ -156,7 +157,7 @@ public:
* @param aColor Color of the text to display.
*/
void SetMessage( int aXPosition, const wxString& aUpperText,
- const wxString& aLowerText, EDA_COLOR_T aColor );
+ const wxString& aLowerText, COLOR4D aColor );
/**
* Function AppendMessage
@@ -169,11 +170,11 @@ public:
*
* @param aUpperText The message upper text.
* @param aLowerText The message lower text.
- * @param aColor A color ID from the KiCad color list (see colors.h).
+ * @param aColor A color to use for the message text
* @param aPad Number of spaces to pad between messages (default = 4).
*/
void AppendMessage( const wxString& aUpperText, const wxString& aLowerText,
- EDA_COLOR_T aColor, int aPad = 6 );
+ COLOR4D aColor, int aPad = 6 );
/**
* Function AppendMessage
diff --git a/include/painter.h b/include/painter.h
index cf6cefc7a0..3d52b8608a 100644
--- a/include/painter.h
+++ b/include/painter.h
@@ -31,7 +31,6 @@
#include
#include
-#include
#include
#include
#include
@@ -178,16 +177,6 @@ public:
return m_worksheetLineWidth;
}
- /**
- * Function TranslateColor
- * Returns the color responding to the one of EDA_COLOR_T enum values.
- * @param aColor equivalent.
- */
- inline const COLOR4D& TranslateColor( EDA_COLOR_T aColor )
- {
- return m_legacyColorMap[aColor];
- }
-
/**
* Function GetBackgroundColor
* Returns current background color settings.
@@ -270,9 +259,6 @@ protected:
float m_worksheetLineWidth; ///< Line width used when drawing worksheet
COLOR4D m_backgroundColor; ///< The background color
-
- /// Map of colors that were usually used for display
- std::map m_legacyColorMap;
};
diff --git a/include/plot_common.h b/include/plot_common.h
index e2df2c62a0..c75fda7560 100644
--- a/include/plot_common.h
+++ b/include/plot_common.h
@@ -144,7 +144,7 @@ public:
return currentPenWidth;
}
- virtual void SetColor( EDA_COLOR_T color ) = 0;
+ virtual void SetColor( COLOR4D color ) = 0;
virtual void SetDash( bool dashed ) = 0;
@@ -364,7 +364,7 @@ public:
* for specific plotters (GERBER) aData is used to pass extra parameters
*/
virtual void Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
@@ -581,7 +581,7 @@ public:
virtual void SetDefaultLineWidth( int width ) override {}
virtual void SetDash( bool dashed ) override;
- virtual void SetColor( EDA_COLOR_T color ) override {}
+ virtual void SetColor( COLOR4D color ) override {}
virtual void SetPenSpeed( int speed )
{
@@ -686,7 +686,7 @@ public:
* The PSLIKE computes the rgb values, the subclass emits the
* operator to actually do it
*/
- virtual void SetColor( EDA_COLOR_T color ) override;
+ virtual void SetColor( COLOR4D color ) override;
protected:
void computeTextParameters( const wxPoint& aPos,
@@ -771,7 +771,7 @@ public:
virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
@@ -842,7 +842,7 @@ public:
virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
@@ -890,7 +890,7 @@ public:
return PLOT_FORMAT_SVG;
}
- virtual void SetColor( EDA_COLOR_T color ) override;
+ virtual void SetColor( COLOR4D color ) override;
virtual bool StartPlot() override;
virtual bool EndPlot() override;
virtual void SetCurrentLineWidth( int width, void* aData = NULL ) override;
@@ -914,7 +914,7 @@ public:
virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
@@ -1009,7 +1009,7 @@ public:
// RS274X has no dashing, nor colours
virtual void SetDash( bool dashed ) override {}
- virtual void SetColor( EDA_COLOR_T color ) override {}
+ virtual void SetColor( COLOR4D color ) override {}
// Currently, aScale and aMirror are not used in gerber plotter
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
@@ -1040,7 +1040,7 @@ public:
virtual void PenTo( const wxPoint& pos, char plume ) override;
virtual void Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
@@ -1209,7 +1209,7 @@ public:
DXF_PLOTTER() : textAsLines( false )
{
textAsLines = true;
- m_currentColor = BLACK;
+ m_currentColor = COLOR4D_BLACK;
}
virtual PlotFormat GetPlotterType() const override
@@ -1248,7 +1248,7 @@ public:
virtual void SetDash( bool dashed ) override;
- virtual void SetColor( EDA_COLOR_T color ) override;
+ virtual void SetColor( COLOR4D color ) override;
virtual void SetViewport( const wxPoint& aOffset, double aIusPerDecimil,
double aScale, bool aMirror ) override;
@@ -1280,7 +1280,7 @@ public:
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode, void* aData ) override;
virtual void Text( const wxPoint& aPos,
- enum EDA_COLOR_T aColor,
+ const COLOR4D aColor,
const wxString& aText,
double aOrient,
const wxSize& aSize,
@@ -1294,7 +1294,7 @@ public:
protected:
bool textAsLines;
- EDA_COLOR_T m_currentColor;
+ COLOR4D m_currentColor;
};
class TITLE_BLOCK;
diff --git a/include/worksheet.h b/include/worksheet.h
index cb2a667edd..b77fd31cbb 100644
--- a/include/worksheet.h
+++ b/include/worksheet.h
@@ -26,7 +26,7 @@
#ifndef WORKSHEET_H_
#define WORKSHEET_H_
-#include // EDA_COLOR_T definition
+#include
#include
// Forward declarations:
@@ -34,6 +34,8 @@ class EDA_DRAW_PANEL;
class EDA_RECT;
class TITLE_BLOCK;
+using KIGFX::COLOR4D;
+
/**
* Function DrawPageLayout is a core function to draw the page layout with
* the frame and the basic inscriptions.
@@ -63,7 +65,7 @@ void DrawPageLayout( wxDC* aDC, EDA_RECT* aClipBox,
TITLE_BLOCK& aTitleBlock,
int aSheetCount, int aSheetNumber,
int aPenWidth, double aScalar,
- EDA_COLOR_T aColor, EDA_COLOR_T aAltColor,
+ COLOR4D aColor, COLOR4D aAltColor,
const wxString& aSheetLayer = wxEmptyString );
diff --git a/include/worksheet_shape_builder.h b/include/worksheet_shape_builder.h
index 8cd5f22d66..b88a5bd1a6 100644
--- a/include/worksheet_shape_builder.h
+++ b/include/worksheet_shape_builder.h
@@ -63,13 +63,13 @@ public:
protected:
WS_DRAW_TYPE m_type; // wsg_line, wsg_rect, wsg_poly, wsg_text
- EDA_COLOR_T m_color;
+ COLOR4D m_color;
WORKSHEET_DATAITEM* m_parent; // an unique identifier, used as link
// to the parent WORKSHEET_DATAITEM item,
// in page layout editor
WS_DRAW_ITEM_BASE( WORKSHEET_DATAITEM* aParent,
- WS_DRAW_TYPE aType, EDA_COLOR_T aColor )
+ WS_DRAW_TYPE aType, COLOR4D aColor )
{
m_type = aType;
m_color = aColor;
@@ -81,7 +81,7 @@ public:
virtual ~WS_DRAW_ITEM_BASE() {}
// Accessors:
- EDA_COLOR_T GetColor() const { return m_color; }
+ COLOR4D GetColor() const { return m_color; }
WS_DRAW_TYPE GetType() const { return m_type; };
WORKSHEET_DATAITEM* GetParent() const { return m_parent; }
@@ -91,13 +91,13 @@ public:
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC)
{
wxPoint offset( 0, 0 );
- DrawWsItem( aClipBox, aDC, offset, UNSPECIFIED_DRAWMODE, UNSPECIFIED_COLOR );
+ DrawWsItem( aClipBox, aDC, offset, UNSPECIFIED_DRAWMODE, UNSPECIFIED_COLOR4D );
}
/// More advanced version of DrawWsItem. This is what must be
/// defined in the derived type.
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) = 0;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) = 0;
/**
* Abstract function: should exist for derived items
@@ -143,7 +143,7 @@ class WS_DRAW_ITEM_LINE : public WS_DRAW_ITEM_BASE
public:
WS_DRAW_ITEM_LINE( WORKSHEET_DATAITEM* aParent,
wxPoint aStart, wxPoint aEnd,
- int aPenWidth, EDA_COLOR_T aColor ) :
+ int aPenWidth, COLOR4D aColor ) :
WS_DRAW_ITEM_BASE( aParent, wsg_line, aColor )
{
m_start = aStart;
@@ -159,7 +159,7 @@ public:
/** The function to draw a WS_DRAW_ITEM_LINE
*/
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
/**
* Virtual function
@@ -200,7 +200,7 @@ public:
public:
WS_DRAW_ITEM_POLYGON( WORKSHEET_DATAITEM* aParent, wxPoint aPos,
- bool aFill, int aPenWidth, EDA_COLOR_T aColor ) :
+ bool aFill, int aPenWidth, COLOR4D aColor ) :
WS_DRAW_ITEM_BASE( aParent, wsg_poly, aColor )
{
m_penWidth = aPenWidth;
@@ -216,7 +216,7 @@ public:
/** The function to draw a WS_DRAW_ITEM_POLYGON
*/
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
/**
* Virtual function
@@ -242,7 +242,7 @@ class WS_DRAW_ITEM_RECT : public WS_DRAW_ITEM_LINE
public:
WS_DRAW_ITEM_RECT( WORKSHEET_DATAITEM* aParent,
wxPoint aStart, wxPoint aEnd,
- int aPenWidth, EDA_COLOR_T aColor ) :
+ int aPenWidth, COLOR4D aColor ) :
WS_DRAW_ITEM_LINE( aParent, aStart, aEnd, aPenWidth, aColor )
{
m_type = wsg_rect;
@@ -251,7 +251,7 @@ public:
/** The function to draw a WS_DRAW_ITEM_RECT
*/
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
/**
* Virtual function
@@ -286,13 +286,13 @@ class WS_DRAW_ITEM_TEXT : public WS_DRAW_ITEM_BASE, public EDA_TEXT
public:
WS_DRAW_ITEM_TEXT( WORKSHEET_DATAITEM* aParent,
wxString& aText, wxPoint aPos, wxSize aSize,
- int aPenWidth, EDA_COLOR_T aColor,
+ int aPenWidth, COLOR4D aColor,
bool aItalic = false, bool aBold = false );
/** The function to draw a WS_DRAW_ITEM_TEXT
*/
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
// Accessors:
int GetPenWidth() { return GetThickness(); }
@@ -327,13 +327,13 @@ class WS_DRAW_ITEM_BITMAP : public WS_DRAW_ITEM_BASE
public:
WS_DRAW_ITEM_BITMAP( WORKSHEET_DATAITEM* aParent, wxPoint aPos )
- :WS_DRAW_ITEM_BASE( aParent, wsg_bitmap, UNSPECIFIED_COLOR )
+ :WS_DRAW_ITEM_BASE( aParent, wsg_bitmap, UNSPECIFIED_COLOR4D )
{
m_pos = aPos;
}
WS_DRAW_ITEM_BITMAP()
- :WS_DRAW_ITEM_BASE( NULL, wsg_bitmap, UNSPECIFIED_COLOR )
+ :WS_DRAW_ITEM_BASE( NULL, wsg_bitmap, UNSPECIFIED_COLOR4D )
{
}
@@ -342,7 +342,7 @@ public:
/** The function to draw a WS_DRAW_ITEM_BITMAP
*/
virtual void DrawWsItem( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
- GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor = UNSPECIFIED_COLOR ) override;
+ GR_DRAWMODE aDrawMode, COLOR4D aColor = UNSPECIFIED_COLOR4D ) override;
/**
* Virtual function
@@ -557,7 +557,7 @@ public:
*/
void BuildWorkSheetGraphicList( const PAGE_INFO& aPageInfo,
const TITLE_BLOCK& aTitleBlock,
- EDA_COLOR_T aColor, EDA_COLOR_T aAltColor );
+ COLOR4D aColor, COLOR4D aAltColor );
/**
* Function BuildFullText
* returns the full text corresponding to the aTextbase,
diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h
index 7ee768d8f7..7a2a2bfad2 100644
--- a/include/wxPcbStruct.h
+++ b/include/wxPcbStruct.h
@@ -117,6 +117,12 @@ protected:
*/
void enableGALSpecificMenus();
+ /**
+ * Helper function to coerce all colors to legacy-compatible when
+ * switching from GAL to legacy canvas
+ */
+ void forceColorsToLegacy();
+
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
/**
* Function RebuildActionPluginMenus
@@ -356,13 +362,13 @@ public:
* Function GetGridColor() , virtual
* @return the color of the grid
*/
- virtual EDA_COLOR_T GetGridColor() const override;
+ virtual COLOR4D GetGridColor() const override;
/**
* Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
- virtual void SetGridColor( EDA_COLOR_T aColor ) override;
+ virtual void SetGridColor( COLOR4D aColor ) override;
///> @copydoc EDA_DRAW_FRAME::SetCursorShape()
virtual void SetCursorShape( int aCursorShape ) override;
diff --git a/include/wxstruct.h b/include/wxstruct.h
index b8f1f38090..9623397cc1 100644
--- a/include/wxstruct.h
+++ b/include/wxstruct.h
@@ -42,7 +42,6 @@
#include
#include
-#include
#include
#include
#include
diff --git a/kicad/CMakeLists.txt b/kicad/CMakeLists.txt
index 97d485af7a..b6b8823d8a 100644
--- a/kicad/CMakeLists.txt
+++ b/kicad/CMakeLists.txt
@@ -73,6 +73,7 @@ else()
common
bitmaps
polygon
+ gal
${wxWidgets_LIBRARIES}
${GDI_PLUS_LIBRARIES}
)
diff --git a/pagelayout_editor/CMakeLists.txt b/pagelayout_editor/CMakeLists.txt
index 70ebc9a5d1..9116fcbc80 100644
--- a/pagelayout_editor/CMakeLists.txt
+++ b/pagelayout_editor/CMakeLists.txt
@@ -76,6 +76,7 @@ target_link_libraries( pl_editor
# There's way too much crap coming in from common yet.
common
bitmaps
+ gal
${wxWidgets_LIBRARIES}
)
diff --git a/pagelayout_editor/dialogs/dialogs_for_printing.cpp b/pagelayout_editor/dialogs/dialogs_for_printing.cpp
index 7a4f5f2620..0735a37610 100644
--- a/pagelayout_editor/dialogs/dialogs_for_printing.cpp
+++ b/pagelayout_editor/dialogs/dialogs_for_printing.cpp
@@ -186,8 +186,8 @@ void PLEDITOR_PRINTOUT::DrawPage( int aPageNum )
GRForceBlackPen( true );
screen->m_IsPrinting = true;
- EDA_COLOR_T bg_color = m_parent->GetDrawBgColor();
- m_parent->SetDrawBgColor( WHITE );
+ COLOR4D bg_color = m_parent->GetDrawBgColor();
+ m_parent->SetDrawBgColor( MakeColour( WHITE ) );
screen->m_ScreenNumber = aPageNum;
m_parent->DrawWorkSheet( dc, screen, 0, IU_PER_MILS, wxEmptyString );
diff --git a/pagelayout_editor/pl_editor_frame.cpp b/pagelayout_editor/pl_editor_frame.cpp
index 0586029aca..4991b8fd7f 100644
--- a/pagelayout_editor/pl_editor_frame.cpp
+++ b/pagelayout_editor/pl_editor_frame.cpp
@@ -689,7 +689,7 @@ WORKSHEET_DATAITEM* PL_EDITOR_FRAME::Locate( const wxPoint& aPosition )
{
const PAGE_INFO& pageInfo = GetPageSettings();
TITLE_BLOCK t_block = GetTitleBlock();
- EDA_COLOR_T color = RED; // Needed, not used
+ COLOR4D color = COLOR4D( RED ); // Needed, not used
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) GetScreen();
screen-> m_ScreenNumber = GetPageNumberOption() ? 1 : 2;
diff --git a/pcb_calculator/CMakeLists.txt b/pcb_calculator/CMakeLists.txt
index 292308c4e5..94d6ce4694 100644
--- a/pcb_calculator/CMakeLists.txt
+++ b/pcb_calculator/CMakeLists.txt
@@ -68,6 +68,7 @@ target_link_libraries( pcb_calculator
# There's way too much crap coming in from common yet.
common
bitmaps
+ gal
${wxWidgets_LIBRARIES}
)
diff --git a/pcbnew/CMakeLists.txt b/pcbnew/CMakeLists.txt
index f64f490b0c..2b58842167 100644
--- a/pcbnew/CMakeLists.txt
+++ b/pcbnew/CMakeLists.txt
@@ -559,6 +559,7 @@ target_link_libraries( pcbnew
# There's way too much crap coming in from common yet.
common
bitmaps
+ gal
${wxWidgets_LIBRARIES}
)
diff --git a/pcbnew/autorouter/auto_place_footprints.cpp b/pcbnew/autorouter/auto_place_footprints.cpp
index 4493d754e2..165e6d70a3 100644
--- a/pcbnew/autorouter/auto_place_footprints.cpp
+++ b/pcbnew/autorouter/auto_place_footprints.cpp
@@ -412,7 +412,7 @@ end_of_tst:
void drawPlacementRoutingMatrix( BOARD* aBrd, wxDC* DC )
{
int ii, jj;
- EDA_COLOR_T color;
+ COLOR4D color;
int ox, oy;
MATRIX_CELL top_state, bottom_state;
@@ -425,21 +425,21 @@ void drawPlacementRoutingMatrix( BOARD* aBrd, wxDC* DC )
for( jj = 0; jj < RoutingMatrix.m_Ncols; jj++ )
{
ox = RoutingMatrix.m_BrdBox.GetX() + (jj * RoutingMatrix.m_GridRouting);
- color = BLACK;
+ color = COLOR4D_BLACK;
top_state = RoutingMatrix.GetCell( ii, jj, TOP );
bottom_state = RoutingMatrix.GetCell( ii, jj, BOTTOM );
if( top_state & CELL_is_ZONE )
- color = BLUE;
+ color = COLOR4D( BLUE );
// obstacles
if( ( top_state & CELL_is_EDGE ) || ( bottom_state & CELL_is_EDGE ) )
- color = WHITE;
+ color = COLOR4D_WHITE;
else if( top_state & ( HOLE | CELL_is_MODULE ) )
- color = LIGHTRED;
+ color = COLOR4D( LIGHTRED );
else if( bottom_state & (HOLE | CELL_is_MODULE) )
- color = LIGHTGREEN;
+ color = COLOR4D( LIGHTGREEN );
else // Display the filling and keep out regions.
{
if( RoutingMatrix.GetDist( ii, jj, TOP )
@@ -605,14 +605,16 @@ void genModuleOnRoutingMatrix( MODULE* Module )
CreateKeepOutRectangle( ox, oy, fx, fy, margin, KEEP_OUT_MARGIN, layerMask );
}
+
// A minor helper function to draw a bounding box:
-inline void draw_FootprintRect(EDA_RECT * aClipBox, wxDC* aDC, EDA_RECT& fpBBox, EDA_COLOR_T aColor)
+inline void draw_FootprintRect( EDA_RECT* aClipBox, wxDC* aDC, EDA_RECT& fpBBox, COLOR4D aColor )
{
#ifndef USE_WX_OVERLAY
GRRect( aClipBox, aDC, fpBBox, 0, aColor );
#endif
}
+
int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aDC )
{
int error = 1;
@@ -676,7 +678,7 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD
}
// Draw the initial bounding box position
- EDA_COLOR_T color = BROWN;
+ COLOR4D color = COLOR4D( BROWN );
fpBBox.SetOrigin( fpBBoxOrg + CurrPosition );
draw_FootprintRect(aFrame->GetCanvas()->GetClipBox(), aDC, fpBBox, color);
diff --git a/pcbnew/autorouter/autorout.cpp b/pcbnew/autorouter/autorout.cpp
index 7c53f0e3d3..5044172ba8 100644
--- a/pcbnew/autorouter/autorout.cpp
+++ b/pcbnew/autorouter/autorout.cpp
@@ -222,7 +222,7 @@ void PCB_EDIT_FRAME::Reset_Noroutable( wxDC* DC )
void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC )
{
int dcell0;
- EDA_COLOR_T color;
+ COLOR4D color;
int maxi = 600 / RoutingMatrix.m_Ncols;
maxi = ( maxi * 3 ) / 4;
@@ -236,11 +236,11 @@ void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC )
{
for( int row = 0; row < RoutingMatrix.m_Nrows; row++ )
{
- color = BLACK;
+ color = COLOR4D_BLACK;
dcell0 = RoutingMatrix.GetCell( row, col, BOTTOM );
if( dcell0 & HOLE )
- color = GREEN;
+ color = COLOR4D( GREEN );
#if 0
int dcell1 = 0;
@@ -249,17 +249,17 @@ void DisplayRoutingMatrix( EDA_DRAW_PANEL* panel, wxDC* DC )
dcell1 = GetCell( row, col, TOP );
if( dcell1 & HOLE )
- color = RED;
+ color = COLOR4D( RED );
dcell0 |= dcell1;
#endif
- if( !color && ( dcell0 & VIA_IMPOSSIBLE ) )
- color = BLUE;
+ if( ( color == COLOR4D_BLACK ) && ( dcell0 & VIA_IMPOSSIBLE ) )
+ color = COLOR4D( BLUE );
if( dcell0 & CELL_is_EDGE )
- color = YELLOW;
+ color = COLOR4D( YELLOW );
else if( dcell0 & CELL_is_ZONE )
- color = YELLOW;
+ color = COLOR4D( YELLOW );
#define DRAW_OFFSET_X -20
#define DRAW_OFFSET_Y 20
diff --git a/pcbnew/board_items_to_polygon_shape_transform.cpp b/pcbnew/board_items_to_polygon_shape_transform.cpp
index cdeae72bb5..92ee3e846e 100644
--- a/pcbnew/board_items_to_polygon_shape_transform.cpp
+++ b/pcbnew/board_items_to_polygon_shape_transform.cpp
@@ -445,7 +445,7 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
s_cornerBuffer = &aCornerBuffer;
s_textWidth = GetThickness() + ( 2 * aClearanceValue );
s_textCircle2SegmentCount = aCircleToSegmentsCount;
- EDA_COLOR_T color = BLACK; // not actually used, but needed by DrawGraphicText
+ COLOR4D color = COLOR4D_BLACK; // not actually used, but needed by DrawGraphicText
if( IsMultilineAllowed() )
{
diff --git a/pcbnew/class_board.cpp b/pcbnew/class_board.cpp
index d715f442fa..a6c82abe39 100644
--- a/pcbnew/class_board.cpp
+++ b/pcbnew/class_board.cpp
@@ -777,9 +777,9 @@ void BOARD::SetElementVisibility( int aPCB_VISIBLE, bool isEnabled )
}
-EDA_COLOR_T BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
+COLOR4D BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
{
- EDA_COLOR_T color = UNSPECIFIED_COLOR;
+ COLOR4D color = UNSPECIFIED_COLOR4D;
switch( aPCB_VISIBLE )
{
@@ -806,7 +806,7 @@ EDA_COLOR_T BOARD::GetVisibleElementColor( int aPCB_VISIBLE )
}
-void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, EDA_COLOR_T aColor )
+void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, COLOR4D aColor )
{
switch( aPCB_VISIBLE )
{
@@ -831,13 +831,13 @@ void BOARD::SetVisibleElementColor( int aPCB_VISIBLE, EDA_COLOR_T aColor )
}
-void BOARD::SetLayerColor( LAYER_ID aLayer, EDA_COLOR_T aColor )
+void BOARD::SetLayerColor( LAYER_ID aLayer, COLOR4D aColor )
{
GetColorsSettings()->SetLayerColor( aLayer, aColor );
}
-EDA_COLOR_T BOARD::GetLayerColor( LAYER_ID aLayer ) const
+COLOR4D BOARD::GetLayerColor( LAYER_ID aLayer ) const
{
return GetColorsSettings()->GetLayerColor( aLayer );
}
diff --git a/pcbnew/class_board.h b/pcbnew/class_board.h
index e43fa5aae1..1045e6da57 100644
--- a/pcbnew/class_board.h
+++ b/pcbnew/class_board.h
@@ -520,9 +520,9 @@ public:
* returns the color of a pcb visible element.
* @see enum PCB_VISIBLE
*/
- EDA_COLOR_T GetVisibleElementColor( int aPCB_VISIBLE );
+ COLOR4D GetVisibleElementColor( int aPCB_VISIBLE );
- void SetVisibleElementColor( int aPCB_VISIBLE, EDA_COLOR_T aColor );
+ void SetVisibleElementColor( int aPCB_VISIBLE, COLOR4D aColor );
/**
* Function GetDesignSettings
@@ -685,13 +685,13 @@ public:
* Function SetLayerColor
* changes a layer color for any valid layer, including non-copper ones.
*/
- void SetLayerColor( LAYER_ID aLayer, EDA_COLOR_T aColor );
+ void SetLayerColor( LAYER_ID aLayer, COLOR4D aColor );
/**
* Function GetLayerColor
* gets a layer color for any valid layer, including non-copper ones.
*/
- EDA_COLOR_T GetLayerColor( LAYER_ID aLayer ) const;
+ COLOR4D GetLayerColor( LAYER_ID aLayer ) const;
/** Functions to get some items count */
int GetNumSegmTrack() const;
diff --git a/pcbnew/class_dimension.cpp b/pcbnew/class_dimension.cpp
index f2ef40f387..db1e65a8ee 100644
--- a/pcbnew/class_dimension.cpp
+++ b/pcbnew/class_dimension.cpp
@@ -316,7 +316,7 @@ void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
void DIMENSION::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
const wxPoint& offset )
{
- EDA_COLOR_T gcolor;
+ COLOR4D gcolor;
BOARD* brd = GetBoard();
if( brd->IsLayerVisible( m_Layer ) == false )
diff --git a/pcbnew/class_drawsegment.cpp b/pcbnew/class_drawsegment.cpp
index cb7292db82..351e532744 100644
--- a/pcbnew/class_drawsegment.cpp
+++ b/pcbnew/class_drawsegment.cpp
@@ -206,7 +206,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
int radius;
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
- EDA_COLOR_T color;
+ COLOR4D color;
BOARD * brd = GetBoard( );
@@ -220,7 +220,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
if( ( draw_mode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) && !IsOnLayer( Edge_Cuts ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
GRSetDrawMode( DC, draw_mode );
diff --git a/pcbnew/class_edge_mod.cpp b/pcbnew/class_edge_mod.cpp
index c8b71428a8..078475a9e6 100644
--- a/pcbnew/class_edge_mod.cpp
+++ b/pcbnew/class_edge_mod.cpp
@@ -119,13 +119,13 @@ void EDGE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
if( brd->IsLayerVisible( m_Layer ) == false )
return;
- EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
+ COLOR4D color = brd->GetLayerColor( m_Layer );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
if(( draw_mode & GR_ALLOW_HIGHCONTRAST ) && displ_opts && displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
ux0 = m_Start.x - offset.x;
diff --git a/pcbnew/class_mire.cpp b/pcbnew/class_mire.cpp
index afe97b2085..f0eac1c137 100644
--- a/pcbnew/class_mire.cpp
+++ b/pcbnew/class_mire.cpp
@@ -89,7 +89,7 @@ void PCB_TARGET::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE mode_color,
if( brd->IsLayerVisible( m_Layer ) == false )
return;
- EDA_COLOR_T gcolor = brd->GetLayerColor( m_Layer );
+ COLOR4D gcolor = brd->GetLayerColor( m_Layer );
GRSetDrawMode( DC, mode_color );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
diff --git a/pcbnew/class_netinfo_item.cpp b/pcbnew/class_netinfo_item.cpp
index c52e9731e1..53cfe660df 100644
--- a/pcbnew/class_netinfo_item.cpp
+++ b/pcbnew/class_netinfo_item.cpp
@@ -174,7 +174,7 @@ void RATSNEST_ITEM::Draw( EDA_DRAW_PANEL* panel,
{
GRSetDrawMode( DC, aDrawMode );
- EDA_COLOR_T color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
+ COLOR4D color = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
GRLine( panel->GetClipBox(), DC,
m_PadStart->GetPosition() - aOffset,
diff --git a/pcbnew/class_pad.h b/pcbnew/class_pad.h
index 6619d31343..669746bd53 100644
--- a/pcbnew/class_pad.h
+++ b/pcbnew/class_pad.h
@@ -57,10 +57,10 @@ class PAD_DRAWINFO
public:
EDA_DRAW_PANEL* m_DrawPanel; // the EDA_DRAW_PANEL used to draw a PAD ; can be null
GR_DRAWMODE m_DrawMode; // the draw mode
- EDA_COLOR_T m_Color; // color used to draw the pad shape , from pad layers and
+ COLOR4D m_Color; // color used to draw the pad shape , from pad layers and
// visible layers
- EDA_COLOR_T m_HoleColor; // color used to draw the pad hole
- EDA_COLOR_T m_NPHoleColor; // color used to draw a pad Not Plated hole
+ COLOR4D m_HoleColor; // color used to draw the pad hole
+ COLOR4D m_NPHoleColor; // color used to draw a pad Not Plated hole
int m_PadClearance; // clearance value, used to draw the pad area outlines
wxSize m_Mask_margin; // margin, used to draw solder paste when only one layer is shown
bool m_Display_padnum; // true to show pad number
diff --git a/pcbnew/class_pad_draw_functions.cpp b/pcbnew/class_pad_draw_functions.cpp
index 817a5ee18b..0a498875e8 100644
--- a/pcbnew/class_pad_draw_functions.cpp
+++ b/pcbnew/class_pad_draw_functions.cpp
@@ -130,7 +130,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
else
drawInfo.m_ShowPadFilled = true;
- EDA_COLOR_T color = BLACK;
+ COLOR4D color = COLOR4D_BLACK;
if( m_layerMask[F_Cu] )
{
@@ -139,7 +139,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
if( m_layerMask[B_Cu] )
{
- color = ColorMix( color, brd->GetVisibleElementColor( PAD_BK_VISIBLE ) );
+ color = color.LegacyMix( brd->GetVisibleElementColor( PAD_BK_VISIBLE ) );
}
if( color == BLACK ) // Not on a visible copper layer (i.e. still nothing to show)
@@ -189,7 +189,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
)
{
if( !IsOnLayer( screen->m_Active_Layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
// else routing between an internal signal layer and some other
// layer. Grey out all PAD_ATTRIB_SMD pads not on current or the single
@@ -198,7 +198,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
&& !IsOnLayer( routeTop )
&& !IsOnLayer( routeBot ) )
{
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
}
// when not edting tracks, show PAD_ATTRIB_SMD components not on active layer
@@ -206,7 +206,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
else
{
if( !IsOnLayer( screen->m_Active_Layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
}
@@ -264,11 +264,8 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
color = DARKDARKGRAY;
}
-
- if( aDraw_mode & GR_HIGHLIGHT )
- ColorChangeHighlightFlag( &color, !(aDraw_mode & GR_AND) );
-
- ColorApplyHighlightFlag( &color );
+ if( ( aDraw_mode & GR_HIGHLIGHT ) && !( aDraw_mode & GR_AND ) )
+ color.SetToLegacyHighlightColor();
bool DisplayIsol = displ_opts && displ_opts->m_DisplayPadIsol;
@@ -288,7 +285,7 @@ void D_PAD::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDraw_mode,
drawInfo.m_Mask_margin = mask_margin;
drawInfo.m_ShowNCMark = brd->IsElementVisible( PCB_VISIBLE( NO_CONNECTS_VISIBLE ) );
drawInfo.m_IsPrinting = screen->m_IsPrinting;
- SetAlpha( &color, 170 );
+ color.a = 0.666;
/* Get the pad clearance. This has a meaning only for Pcbnew.
* for CvPcb GetClearance() creates debug errors because
@@ -488,7 +485,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
GRSetDrawMode( aDC, ( aDrawInfo.m_DrawMode != GR_XOR ) ? GR_COPY : GR_XOR );
}
- EDA_COLOR_T hole_color = aDrawInfo.m_HoleColor;
+ COLOR4D hole_color = aDrawInfo.m_HoleColor;
if( aDrawInfo. m_ShowNotPlatedHole ) // Draw a specific hole color
hole_color = aDrawInfo.m_NPHoleColor;
@@ -524,7 +521,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
if( GetNetCode() == 0 && aDrawInfo.m_ShowNCMark )
{
int dx0 = std::min( halfsize.x, halfsize.y );
- EDA_COLOR_T nc_color = BLUE;
+ COLOR4D nc_color = COLOR4D( BLUE );
if( m_layerMask[F_Cu] ) /* Draw \ */
GRLine( aClipBox, aDC, holepos.x - dx0, holepos.y - dx0,
diff --git a/pcbnew/class_pcb_layer_box_selector.cpp b/pcbnew/class_pcb_layer_box_selector.cpp
index ee02ba604a..152be82245 100644
--- a/pcbnew/class_pcb_layer_box_selector.cpp
+++ b/pcbnew/class_pcb_layer_box_selector.cpp
@@ -146,7 +146,7 @@ LSET PCB_LAYER_BOX_SELECTOR::getEnabledLayers() const
// Returns a color index from the layer id
-EDA_COLOR_T PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
+COLOR4D PCB_LAYER_BOX_SELECTOR::GetLayerColor( LAYER_NUM aLayer ) const
{
wxASSERT( m_boardFrame );
BOARD* board = m_boardFrame->GetBoard();
diff --git a/pcbnew/class_pcb_layer_box_selector.h b/pcbnew/class_pcb_layer_box_selector.h
index fbcd30ada3..59ee6fbf2d 100644
--- a/pcbnew/class_pcb_layer_box_selector.h
+++ b/pcbnew/class_pcb_layer_box_selector.h
@@ -89,7 +89,7 @@ public:
private:
// Returns a color index from the layer id
// Virtual function
- EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const override;
+ COLOR4D GetLayerColor( LAYER_NUM aLayer ) const override;
// Returns true if the layer id is enabled (i.e. is it should be displayed)
// Virtual function
diff --git a/pcbnew/class_pcb_layer_widget.cpp b/pcbnew/class_pcb_layer_widget.cpp
index 6faef76b38..0fe14ed96d 100644
--- a/pcbnew/class_pcb_layer_widget.cpp
+++ b/pcbnew/class_pcb_layer_widget.cpp
@@ -67,17 +67,17 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = {
RR( _( "Pads Front" ), PAD_FR_VISIBLE, WHITE, _( "Show footprint pads on board's front" ) ),
RR( _( "Pads Back" ), PAD_BK_VISIBLE, WHITE, _( "Show footprint pads on board's back" ) ),
- RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprint text on board's front" ) ),
- RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprint text on board's back" ) ),
+ RR( _( "Text Front" ), MOD_TEXT_FR_VISIBLE, UNSPECIFIED_COLOR4D, _( "Show footprint text on board's front" ) ),
+ RR( _( "Text Back" ), MOD_TEXT_BK_VISIBLE, UNSPECIFIED_COLOR4D, _( "Show footprint text on board's back" ) ),
RR( _( "Hidden Text" ), MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ),
RR( _( "Anchors" ), ANCHOR_VISIBLE, WHITE, _( "Show footprint and text origins as a cross" ) ),
RR( _( "Grid" ), GRID_VISIBLE, WHITE, _( "Show the (x,y) grid dots" ) ),
- RR( _( "No-Connects" ), NO_CONNECTS_VISIBLE, UNSPECIFIED_COLOR, _( "Show a marker on pads which have no net connected" ) ),
- RR( _( "Footprints Front" ), MOD_FR_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprints that are on board's front") ),
- RR( _( "Footprints Back" ), MOD_BK_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprints that are on board's back") ),
- RR( _( "Values" ), MOD_VALUES_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprint's values") ),
- RR( _( "References" ), MOD_REFERENCES_VISIBLE, UNSPECIFIED_COLOR, _( "Show footprint's references") ),
+ RR( _( "No-Connects" ), NO_CONNECTS_VISIBLE, UNSPECIFIED_COLOR4D, _( "Show a marker on pads which have no net connected" ) ),
+ RR( _( "Footprints Front" ), MOD_FR_VISIBLE, UNSPECIFIED_COLOR4D, _( "Show footprints that are on board's front") ),
+ RR( _( "Footprints Back" ), MOD_BK_VISIBLE, UNSPECIFIED_COLOR4D, _( "Show footprints that are on board's back") ),
+ RR( _( "Values" ), MOD_VALUES_VISIBLE, UNSPECIFIED_COLOR4D, _( "Show footprint's values") ),
+ RR( _( "References" ), MOD_REFERENCES_VISIBLE, UNSPECIFIED_COLOR4D, _( "Show footprint's references") ),
};
static int s_allowed_in_FpEditor[] =
@@ -115,6 +115,12 @@ PCB_LAYER_WIDGET::PCB_LAYER_WIDGET( PCB_BASE_FRAME* aParent, wxWindow* aFocusOwn
}
+bool PCB_LAYER_WIDGET::AreArbitraryColorsAllowed()
+{
+ return myframe->IsGalCanvasActive();
+}
+
+
bool PCB_LAYER_WIDGET::isAllowedInFpMode( int aId )
{
for( unsigned ii = 0; ii < DIM( s_allowed_in_FpEditor ); ii++ )
@@ -293,7 +299,7 @@ void PCB_LAYER_WIDGET::ReFillRender()
renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip );
renderRow.rowName = wxGetTranslation( s_render_rows[row].rowName );
- if( renderRow.color != -1 ) // does this row show a color?
+ if( renderRow.color != UNSPECIFIED_COLOR4D ) // does this row show a color?
{
// this window frame must have an established BOARD, i.e. after SetBoard()
renderRow.color = board->GetVisibleElementColor( renderRow.id );
@@ -437,7 +443,7 @@ void PCB_LAYER_WIDGET::ReFill()
//------------------------------------------------
-void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
+void PCB_LAYER_WIDGET::OnLayerColorChange( int aLayer, COLOR4D aColor )
{
myframe->GetBoard()->SetLayerColor( ToLAYER_ID( aLayer ), aColor );
@@ -509,7 +515,7 @@ void PCB_LAYER_WIDGET::OnLayerVisible( int aLayer, bool isVisible, bool isFinal
}
-void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor )
+void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, COLOR4D aColor )
{
myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
diff --git a/pcbnew/class_pcb_layer_widget.h b/pcbnew/class_pcb_layer_widget.h
index 69e99b3b30..be1fe4e0c6 100644
--- a/pcbnew/class_pcb_layer_widget.h
+++ b/pcbnew/class_pcb_layer_widget.h
@@ -88,10 +88,10 @@ public:
void SetLayersManagerTabsText();
//----------------
- void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) override;
+ void OnLayerColorChange( int aLayer, COLOR4D aColor ) override;
bool OnLayerSelect( int aLayer ) override;
void OnLayerVisible( int aLayer, bool isVisible, bool isFinal ) override;
- void OnRenderColorChange( int aId, EDA_COLOR_T aColor ) override;
+ void OnRenderColorChange( int aId, COLOR4D aColor ) override;
void OnRenderEnable( int aId, bool isEnabled ) override;
//---------------
@@ -125,6 +125,7 @@ protected:
#define ID_SHOW_NO_LAYERS (wxID_HIGHEST+4)
#define ID_SHOW_ALL_LAYERS (wxID_HIGHEST+5)
+ virtual bool AreArbitraryColorsAllowed() override;
/**
* Function isAllowedInFpMode
diff --git a/pcbnew/class_pcb_text.cpp b/pcbnew/class_pcb_text.cpp
index d2ed8ff010..6c2217a4b4 100644
--- a/pcbnew/class_pcb_text.cpp
+++ b/pcbnew/class_pcb_text.cpp
@@ -75,7 +75,7 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
if( brd->IsLayerVisible( m_Layer ) == false )
return;
- EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
+ COLOR4D color = brd->GetLayerColor( m_Layer );
EDA_DRAW_MODE_T fillmode = FILLED;
DISPLAY_OPTIONS* displ_opts =
@@ -90,10 +90,10 @@ void TEXTE_PCB::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( !IsOnLayer( curr_layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
- EDA_COLOR_T anchor_color = UNSPECIFIED_COLOR;
+ COLOR4D anchor_color = UNSPECIFIED_COLOR4D;
if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
anchor_color = brd->GetVisibleElementColor( ANCHOR_VISIBLE );
diff --git a/pcbnew/class_text_mod.cpp b/pcbnew/class_text_mod.cpp
index 2925fce647..460ce0a105 100644
--- a/pcbnew/class_text_mod.cpp
+++ b/pcbnew/class_text_mod.cpp
@@ -223,7 +223,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod
wxASSERT( m_Parent );
BOARD* brd = GetBoard( );
- EDA_COLOR_T color = brd->GetLayerColor( GetLayer() );
+ COLOR4D color = brd->GetLayerColor( GetLayer() );
LAYER_ID text_layer = GetLayer();
if( !brd->IsLayerVisible( m_Layer )
@@ -249,7 +249,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod
LAYER_ID curr_layer = ( (PCB_SCREEN*) aPanel->GetScreen() )->m_Active_Layer;
if( !IsOnLayer( curr_layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
// Draw mode compensation for the width
@@ -264,7 +264,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMod
// Draw the text anchor point
if( brd->IsElementVisible( ANCHOR_VISIBLE ) )
{
- EDA_COLOR_T anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
+ COLOR4D anchor_color = brd->GetVisibleElementColor(ANCHOR_VISIBLE);
GRDrawAnchor( aPanel->GetClipBox(), aDC, pos.x, pos.y, DIM_ANCRE_TEXTE, anchor_color );
}
diff --git a/pcbnew/class_track.cpp b/pcbnew/class_track.cpp
index 92dc2d626e..4e7774c5ef 100644
--- a/pcbnew/class_track.cpp
+++ b/pcbnew/class_track.cpp
@@ -546,7 +546,7 @@ TRACK* TRACK::GetEndNetCode( int NetCode )
}
void TRACK::DrawShortNetname( EDA_DRAW_PANEL* panel,
- wxDC* aDC, GR_DRAWMODE aDrawMode, EDA_COLOR_T aBgColor )
+ wxDC* aDC, GR_DRAWMODE aDrawMode, COLOR4D aBgColor )
{
if( ! panel )
return;
@@ -636,8 +636,8 @@ void TRACK::DrawShortNetname( EDA_DRAW_PANEL* panel,
void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset )
{
- BOARD * brd = GetBoard( );
- EDA_COLOR_T color = brd->GetLayerColor(m_Layer);
+ BOARD* brd = GetBoard();
+ COLOR4D color = brd->GetLayerColor( m_Layer );
if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
return;
@@ -655,15 +655,13 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( !IsOnLayer( curr_layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
- if( aDrawMode & GR_HIGHLIGHT )
- ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) );
+ if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
+ color.SetToLegacyHighlightColor();
- ColorApplyHighlightFlag( &color );
-
- SetAlpha( &color, 150 );
+ color.a = 0.588;
GRSetDrawMode( aDC, aDrawMode );
@@ -708,8 +706,8 @@ void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
if( displ_opts->m_DisplayZonesMode != 0 )
return;
- BOARD * brd = GetBoard( );
- EDA_COLOR_T color = brd->GetLayerColor(m_Layer);
+ BOARD* brd = GetBoard();
+ COLOR4D color = brd->GetLayerColor( m_Layer );
if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
return;
@@ -725,15 +723,13 @@ void SEGZONE::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
if( !IsOnLayer( curr_layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
- if( aDrawMode & GR_HIGHLIGHT )
- ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) );
+ if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
+ color.SetToLegacyHighlightColor();
- ColorApplyHighlightFlag( &color );
-
- SetAlpha( &color, 150 );
+ color.a = 0.588;
GRSetDrawMode( aDC, aDrawMode );
@@ -800,11 +796,11 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
GRSetDrawMode( aDC, aDrawMode );
BOARD * brd = GetBoard();
- EDA_COLOR_T color = brd->GetVisibleElementColor( VIAS_VISIBLE + GetViaType() );
+ COLOR4D color = brd->GetVisibleElementColor( VIAS_VISIBLE + GetViaType() );
if( brd->IsElementVisible( PCB_VISIBLE(VIAS_VISIBLE + GetViaType()) ) == false
- && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
- return;
+ && !( aDrawMode & GR_HIGHLIGHT ) )
+ return;
// Only draw the via if at least one of the layers it crosses is being displayed
if( !( brd->GetVisibleLayers() & GetLayerSet() ).any() )
@@ -813,15 +809,13 @@ void VIA::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode, const w
if( displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
- if( aDrawMode & GR_HIGHLIGHT )
- ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) );
+ if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
+ color.SetToLegacyHighlightColor();
- ColorApplyHighlightFlag( &color );
-
- SetAlpha( &color, 150 );
+ color.a = 0.588;
radius = m_Width >> 1;
diff --git a/pcbnew/class_track.h b/pcbnew/class_track.h
index 6e2ff54c23..a9cee7015e 100644
--- a/pcbnew/class_track.h
+++ b/pcbnew/class_track.h
@@ -332,7 +332,7 @@ protected:
/**
* Helper for drawing the short netname in tracks */
void DrawShortNetname( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
- EDA_COLOR_T aBgColor );
+ COLOR4D aBgColor );
int m_Width; ///< Thickness of track, or via diameter
wxPoint m_Start; ///< Line start point
diff --git a/pcbnew/class_zone.cpp b/pcbnew/class_zone.cpp
index 99795a81f4..a716184ab9 100644
--- a/pcbnew/class_zone.cpp
+++ b/pcbnew/class_zone.cpp
@@ -175,9 +175,9 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD* brd = GetBoard();
- EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
+ COLOR4D color = brd->GetLayerColor( m_Layer );
- if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
+ if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
return;
GRSetDrawMode( DC, aDrawMode );
@@ -186,15 +186,13 @@ void ZONE_CONTAINER::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE aDrawMod
if( displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
- if( aDrawMode & GR_HIGHLIGHT )
- ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) );
+ if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
+ color.SetToLegacyHighlightColor();
- ColorApplyHighlightFlag( &color );
-
- SetAlpha( &color, 150 );
+ color.a = 0.588;
// draw the lines
int i_start_contour = 0;
@@ -258,9 +256,9 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
BOARD* brd = GetBoard();
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
- EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
+ COLOR4D color = brd->GetLayerColor( m_Layer );
- if( brd->IsLayerVisible( m_Layer ) == false && ( color & HIGHLIGHT_FLAG ) != HIGHLIGHT_FLAG )
+ if( brd->IsLayerVisible( m_Layer ) == false && !( aDrawMode & GR_HIGHLIGHT ) )
return;
GRSetDrawMode( DC, aDrawMode );
@@ -268,15 +266,13 @@ void ZONE_CONTAINER::DrawFilledArea( EDA_DRAW_PANEL* panel,
if( displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
- if( aDrawMode & GR_HIGHLIGHT )
- ColorChangeHighlightFlag( &color, !(aDrawMode & GR_AND) );
+ if( ( aDrawMode & GR_HIGHLIGHT ) && !( aDrawMode & GR_AND ) )
+ color.SetToLegacyHighlightColor();
- ColorApplyHighlightFlag( &color );
-
- SetAlpha( &color, 150 );
+ color.a = 0.588;
for ( int ic = 0; ic < m_FilledPolysList.OutlineCount(); ic++ )
@@ -386,13 +382,13 @@ void ZONE_CONTAINER::DrawWhileCreateOutline( EDA_DRAW_PANEL* panel, wxDC* DC,
LAYER_ID curr_layer = ( (PCB_SCREEN*) panel->GetScreen() )->m_Active_Layer;
BOARD* brd = GetBoard();
- EDA_COLOR_T color = brd->GetLayerColor( m_Layer );
+ COLOR4D color = brd->GetLayerColor( m_Layer );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
if( displ_opts->m_ContrastModeDisplay )
{
if( !IsOnLayer( curr_layer ) )
- ColorTurnToDarkDarkGray( &color );
+ color = COLOR4D( DARKDARKGRAY );
}
// draw the lines
diff --git a/pcbnew/dialogs/dialog_SVG_print.cpp b/pcbnew/dialogs/dialog_SVG_print.cpp
index f33c2f6bb9..68ec60cee5 100644
--- a/pcbnew/dialogs/dialog_SVG_print.cpp
+++ b/pcbnew/dialogs/dialog_SVG_print.cpp
@@ -336,7 +336,7 @@ bool DIALOG_SVG_PRINT::CreateSVGFile( const wxString& aFullFileName, bool aOnlyO
plot_opts.SetMirror( m_printMirror );
plot_opts.SetFormat( PLOT_FORMAT_SVG );
- EDA_COLOR_T color = UNSPECIFIED_COLOR; // Used layer color to plot ref and value
+ COLOR4D color = UNSPECIFIED_COLOR4D; // Used layer color to plot ref and value
plot_opts.SetReferenceColor( color );
plot_opts.SetValueColor( color );
diff --git a/pcbnew/dialogs/dialog_copper_zones.cpp b/pcbnew/dialogs/dialog_copper_zones.cpp
index 2f34a5157c..b20b24106b 100644
--- a/pcbnew/dialogs/dialog_copper_zones.cpp
+++ b/pcbnew/dialogs/dialog_copper_zones.cpp
@@ -115,7 +115,7 @@ private:
* creates the colored rectangle bitmaps used in the layer selection widget.
* @param aColor is the color to fill the rectangle with.
*/
- wxBitmap makeLayerBitmap( EDA_COLOR_T aColor );
+ wxBitmap makeLayerBitmap( COLOR4D aColor );
};
@@ -253,7 +253,7 @@ void DIALOG_COPPER_ZONE::initDialog()
msg.Trim();
- EDA_COLOR_T layerColor = board->GetLayerColor( layer );
+ COLOR4D layerColor = board->GetLayerColor( layer );
imageList->Add( makeLayerBitmap( layerColor ) );
@@ -681,14 +681,14 @@ void DIALOG_COPPER_ZONE::buildAvailableListOfNets()
}
-wxBitmap DIALOG_COPPER_ZONE::makeLayerBitmap( EDA_COLOR_T aColor )
+wxBitmap DIALOG_COPPER_ZONE::makeLayerBitmap( COLOR4D aColor )
{
wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
wxBrush brush;
wxMemoryDC iconDC;
iconDC.SelectObject( bitmap );
- brush.SetColour( MakeColour( aColor ) );
+ brush.SetColour( aColor.ToColour() );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
iconDC.SetBrush( brush );
iconDC.DrawRectangle( 0, 0, LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
diff --git a/pcbnew/dialogs/dialog_keepout_area_properties.cpp b/pcbnew/dialogs/dialog_keepout_area_properties.cpp
index e9f4887008..9da362d898 100644
--- a/pcbnew/dialogs/dialog_keepout_area_properties.cpp
+++ b/pcbnew/dialogs/dialog_keepout_area_properties.cpp
@@ -83,7 +83,7 @@ private:
* creates the colored rectangle bitmaps used in the layer selection widget.
* @param aColor is the color to fill the rectangle with.
*/
- wxBitmap makeLayerBitmap( EDA_COLOR_T aColor );
+ wxBitmap makeLayerBitmap( COLOR4D aColor );
};
@@ -164,7 +164,7 @@ void DIALOG_KEEPOUT_AREA_PROPERTIES::initDialog()
msg = board->GetLayerName( layer );
- EDA_COLOR_T layerColor = board->GetLayerColor( layer );
+ COLOR4D layerColor = board->GetLayerColor( layer );
imageList->Add( makeLayerBitmap( layerColor ) );
@@ -255,14 +255,14 @@ bool DIALOG_KEEPOUT_AREA_PROPERTIES::AcceptOptionsForKeepOut()
}
-wxBitmap DIALOG_KEEPOUT_AREA_PROPERTIES::makeLayerBitmap( EDA_COLOR_T aColor )
+wxBitmap DIALOG_KEEPOUT_AREA_PROPERTIES::makeLayerBitmap( COLOR4D aColor )
{
wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
wxBrush brush;
wxMemoryDC iconDC;
iconDC.SelectObject( bitmap );
- brush.SetColour( MakeColour( aColor ) );
+ brush.SetColour( aColor.ToColour() );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
iconDC.SetBrush( brush );
diff --git a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp
index 552dd73043..d55eea78f1 100644
--- a/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp
+++ b/pcbnew/dialogs/dialog_non_copper_zones_properties.cpp
@@ -73,7 +73,7 @@ private:
* creates the colored rectangle bitmaps used in the layer selection widget.
* @param aColor is the color to fill the rectangle with.
*/
- wxBitmap makeLayerBitmap( EDA_COLOR_T aColor );
+ wxBitmap makeLayerBitmap( COLOR4D aColor );
};
@@ -155,7 +155,7 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::Init()
{
LAYER_ID layer = *seq;
- EDA_COLOR_T layerColor = board->GetLayerColor( layer );
+ COLOR4D layerColor = board->GetLayerColor( layer );
imageList->Add( makeLayerBitmap( layerColor ) );
msg = board->GetLayerName( layer );
@@ -251,14 +251,14 @@ void DIALOG_NON_COPPER_ZONES_EDITOR::OnCancelClick( wxCommandEvent& event )
}
-wxBitmap DIALOG_NON_COPPER_ZONES_EDITOR::makeLayerBitmap( EDA_COLOR_T aColor )
+wxBitmap DIALOG_NON_COPPER_ZONES_EDITOR::makeLayerBitmap( COLOR4D aColor )
{
wxBitmap bitmap( LAYER_BITMAP_SIZE_X, LAYER_BITMAP_SIZE_Y );
wxBrush brush;
wxMemoryDC iconDC;
iconDC.SelectObject( bitmap );
- brush.SetColour( MakeColour( aColor ) );
+ brush.SetColour( aColor.ToColour() );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
iconDC.SetBrush( brush );
diff --git a/pcbnew/dialogs/dialog_pad_properties.cpp b/pcbnew/dialogs/dialog_pad_properties.cpp
index 517abcc074..919df4f5da 100644
--- a/pcbnew/dialogs/dialog_pad_properties.cpp
+++ b/pcbnew/dialogs/dialog_pad_properties.cpp
@@ -167,7 +167,7 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
wxPaintDC dc( m_panelShowPad );
PAD_DRAWINFO drawInfo;
- EDA_COLOR_T color = BLACK;
+ COLOR4D color = COLOR4D_BLACK;
if( m_dummyPad->GetLayerSet()[F_Cu] )
{
@@ -176,7 +176,7 @@ void DIALOG_PAD_PROPERTIES::OnPaintShowPanel( wxPaintEvent& event )
if( m_dummyPad->GetLayerSet()[B_Cu] )
{
- color = ColorMix( color, m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) );
+ color = color.LegacyMix( m_board->GetVisibleElementColor( PAD_BK_VISIBLE ) );
}
// What could happen: the pad color is *actually* black, or no
diff --git a/pcbnew/editrack.cpp b/pcbnew/editrack.cpp
index d556096df6..c5081edcd4 100644
--- a/pcbnew/editrack.cpp
+++ b/pcbnew/editrack.cpp
@@ -660,7 +660,7 @@ inline void DrawViaCirclesWhenEditingNewTrack( EDA_RECT* aPanelClipBox,
wxDC* aDC, const wxPoint& aPos,
int aViaRadius,
int aViaRadiusWithClearence,
- EDA_COLOR_T aColor)
+ COLOR4D aColor)
{
//Current viasize clearence circle
GRCircle( aPanelClipBox, aDC, aPos.x, aPos.y, aViaRadiusWithClearence, aColor );
@@ -706,7 +706,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
{
- EDA_COLOR_T color = g_ColorsSettings.GetLayerColor( g_CurrentTrackSegment->GetLayer() );
+ COLOR4D color = g_ColorsSettings.GetLayerColor( g_CurrentTrackSegment->GetLayer() );
DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->GetEnd(),
boardViaRadius, viaRadiusWithClearence, color);
}
@@ -773,7 +773,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
if( showTrackClearanceMode >= SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS )
{
- EDA_COLOR_T color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
+ COLOR4D color = g_ColorsSettings.GetLayerColor(g_CurrentTrackSegment->GetLayer());
//Via diameter must have taken what we are using, rather than netclass value.
DrawViaCirclesWhenEditingNewTrack( panelClipBox, aDC, g_CurrentTrackSegment->GetEnd(),
diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp
index 5793b34e9c..8b502dee58 100644
--- a/pcbnew/exporters/export_vrml.cpp
+++ b/pcbnew/exporters/export_vrml.cpp
@@ -734,7 +734,7 @@ static void export_vrml_pcbtext( MODEL_VRML& aModel, TEXTE_PCB* text )
if( text->IsMirrored() )
size.x = -size.x;
- EDA_COLOR_T color = BLACK; // not actually used, but needed by DrawGraphicText
+ COLOR4D color = COLOR4D_BLACK; // not actually used, but needed by DrawGraphicText
if( text->IsMultilineAllowed() )
{
diff --git a/pcbnew/exporters/gen_drill_report_files.cpp b/pcbnew/exporters/gen_drill_report_files.cpp
index eabcf40ed0..36e7ad3450 100644
--- a/pcbnew/exporters/gen_drill_report_files.cpp
+++ b/pcbnew/exporters/gen_drill_report_files.cpp
@@ -219,7 +219,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
// Plot title "Info"
wxString Text = wxT( "Drill Map:" );
- plotter->Text( wxPoint( plotX, plotY ), UNSPECIFIED_COLOR, Text, 0,
+ plotter->Text( wxPoint( plotX, plotY ), UNSPECIFIED_COLOR4D, Text, 0,
wxSize( KiROUND( charSize * charScale ),
KiROUND( charSize * charScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
@@ -266,7 +266,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
if( tool.m_Hole_NotPlated )
msg += wxT( " (not plated)" );
- plotter->Text( wxPoint( plotX, y ), UNSPECIFIED_COLOR, msg, 0,
+ plotter->Text( wxPoint( plotX, y ), UNSPECIFIED_COLOR4D, msg, 0,
wxSize( KiROUND( charSize * charScale ),
KiROUND( charSize * charScale ) ),
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER,
diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp
index da861fcd83..181cce12ba 100644
--- a/pcbnew/layer_widget.cpp
+++ b/pcbnew/layer_widget.cpp
@@ -37,18 +37,18 @@
#include
#include
-#include
#include
+#include
#include
#define BUTT_SIZE_X 20
#define BUTT_SIZE_Y 18
-#define BUTT_VOID 4
+#define BUTT_VOID 2
// See selcolor.cpp:
-extern EDA_COLOR_T DisplayColorFrame( wxWindow* aParent, EDA_COLOR_T aOldColor );
+extern COLOR4D DisplayColorFrame( wxWindow* aParent, COLOR4D aOldColor );
const wxEventType LAYER_WIDGET::EVT_LAYER_COLOR_CHANGE = wxNewEventType();
@@ -152,14 +152,12 @@ static const char * rightarrow_alternate_xpm[] = {
/**
* Function makeColorTxt
- * returns a string containing the numeric value of the color.
- * in a form like 0x00000000. (Color is currently an index, not RGB).
+ * returns a string representing the color in CSS format
+ * For example: "rgba(255, 0, 0, 255)"
*/
-static wxString makeColorTxt( EDA_COLOR_T aColor )
+static wxString makeColorTxt( COLOR4D aColor )
{
- wxString txt;
- txt.Printf( wxT("0x%08x"), aColor );
- return txt;
+ return aColor.ToWxString( wxC2S_CSS_SYNTAX );
}
@@ -189,7 +187,7 @@ LAYER_NUM LAYER_WIDGET::getDecodedId( int aControlId )
}
-wxBitmap LAYER_WIDGET::makeBitmap( EDA_COLOR_T aColor )
+wxBitmap LAYER_WIDGET::makeBitmap( COLOR4D aColor )
{
// the bitmap will be BUTT_VOID*2 pixels smaller than the button, leaving a
// border of BUTT_VOID pixels on each side.
@@ -199,7 +197,7 @@ wxBitmap LAYER_WIDGET::makeBitmap( EDA_COLOR_T aColor )
iconDC.SelectObject( bitmap );
- brush.SetColour( MakeColour( aColor ) );
+ brush.SetColour( aColor.ToColour() );
brush.SetStyle( wxBRUSHSTYLE_SOLID );
iconDC.SetBrush( brush );
@@ -210,7 +208,7 @@ wxBitmap LAYER_WIDGET::makeBitmap( EDA_COLOR_T aColor )
}
-wxBitmapButton* LAYER_WIDGET::makeColorButton( wxWindow* aParent, EDA_COLOR_T aColor, int aID )
+wxBitmapButton* LAYER_WIDGET::makeColorButton( wxWindow* aParent, COLOR4D aColor, int aID )
{
// dynamically make a wxBitMap and brush it with the appropriate color,
// then create a wxBitmapButton from it.
@@ -283,14 +281,31 @@ void LAYER_WIDGET::OnMiddleDownLayerColor( wxMouseEvent& aEvent )
wxString colorTxt = eventSource->GetName();
- EDA_COLOR_T oldColor = ColorFromInt( strtoul( TO_UTF8(colorTxt), NULL, 0 ) );
- EDA_COLOR_T newColor = DisplayColorFrame( this, oldColor );
+ COLOR4D oldColor;
+ wxASSERT( oldColor.SetFromWxString( colorTxt ) );
+ COLOR4D newColor = UNSPECIFIED_COLOR4D;
- if( newColor >= 0 )
+ if( AreArbitraryColorsAllowed() )
+ {
+ wxColourData colourData;
+ colourData.SetColour( oldColor.ToColour() );
+ wxColourDialog* dialog = new wxColourDialog( m_LayerScrolledWindow, &colourData );
+
+ if( dialog->ShowModal() == wxID_OK )
+ {
+ newColor = COLOR4D( dialog->GetColourData().GetColour() );
+ }
+ }
+ else
+ {
+ newColor = DisplayColorFrame( this, oldColor );
+ }
+
+ if( newColor != UNSPECIFIED_COLOR4D )
{
eventSource->SetName( makeColorTxt( newColor ) );
- wxBitmap bm = makeBitmap( newColor );
+ wxBitmap bm = makeBitmap( newColor.ToColour() );
eventSource->SetBitmapLabel( bm );
LAYER_NUM layer = getDecodedId( eventSource->GetId() );
@@ -322,10 +337,27 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event )
wxString colorTxt = eventSource->GetName();
- EDA_COLOR_T oldColor = ColorFromInt( strtoul( TO_UTF8(colorTxt), NULL, 0 ) );
- EDA_COLOR_T newColor = DisplayColorFrame( this, oldColor );
+ COLOR4D oldColor;
+ wxASSERT( oldColor.SetFromWxString( colorTxt ) );
+ COLOR4D newColor = UNSPECIFIED_COLOR4D;
- if( newColor >= 0 )
+ if( AreArbitraryColorsAllowed() )
+ {
+ wxColourData colourData;
+ colourData.SetColour( oldColor.ToColour() );
+ wxColourDialog *dialog = new wxColourDialog( m_LayerScrolledWindow, &colourData );
+
+ if( dialog->ShowModal() == wxID_OK )
+ {
+ newColor = COLOR4D( dialog->GetColourData().GetColour() );
+ }
+ }
+ else
+ {
+ newColor = DisplayColorFrame( this, oldColor );
+ }
+
+ if( newColor != UNSPECIFIED_COLOR4D )
{
eventSource->SetName( makeColorTxt( newColor ) );
@@ -427,6 +459,7 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
// column 1 (COLUMN_COLORBM)
col = COLUMN_COLORBM;
+
wxBitmapButton* bmb = makeColorButton( m_LayerScrolledWindow, aSpec.color, encodeId( col, aSpec.id ) );
bmb->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( LAYER_WIDGET::OnLeftDownLayers ), NULL, this );
bmb->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( LAYER_WIDGET::OnMiddleDownLayerColor ), NULL, this );
@@ -462,7 +495,7 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec )
// column 0
col = 0;
- if( aSpec.color != -1 )
+ if( aSpec.color != UNSPECIFIED_COLOR4D )
{
wxBitmapButton* bmb = makeColorButton( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ) );
bmb->Connect( wxEVT_LEFT_DCLICK, wxMouseEventHandler( LAYER_WIDGET::OnMiddleDownRenderColor ), NULL, this );
@@ -764,7 +797,7 @@ bool LAYER_WIDGET::IsLayerVisible( LAYER_NUM aLayer )
}
-void LAYER_WIDGET::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
+void LAYER_WIDGET::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
{
int row = findLayerRow( aLayer );
if( row >= 0 )
@@ -781,7 +814,7 @@ void LAYER_WIDGET::SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor )
}
-EDA_COLOR_T LAYER_WIDGET::GetLayerColor( LAYER_NUM aLayer ) const
+COLOR4D LAYER_WIDGET::GetLayerColor( LAYER_NUM aLayer ) const
{
int row = findLayerRow( aLayer );
if( row >= 0 )
@@ -794,7 +827,7 @@ EDA_COLOR_T LAYER_WIDGET::GetLayerColor( LAYER_NUM aLayer ) const
return ColorFromInt( strtoul( TO_UTF8(colorTxt), NULL, 0 ) );
}
- return UNSPECIFIED_COLOR; // it's caller fault, gave me a bad layer
+ return UNSPECIFIED_COLOR4D; // it's caller fault, gave me a bad layer
}
@@ -860,7 +893,7 @@ class MYFRAME : public wxFrame
{
}
- void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor )
+ void OnLayerColorChange( int aLayer, COLOR4D aColor )
{
printf( "OnLayerColorChange( aLayer:%d, aColor:%d )\n", aLayer, aColor );
@@ -884,7 +917,7 @@ class MYFRAME : public wxFrame
printf( "OnLayerVisible( aLayer:%d, isVisible:%d isFinal:%d)\n", aLayer, isVisible, isFinal );
}
- void OnRenderColorChange( int aId, EDA_COLOR_T aColor )
+ void OnRenderColorChange( int aId, COLOR4D aColor )
{
printf( "OnRenderColorChange( aId:%d, aColor:%d )\n", aId, aColor );
}
@@ -918,7 +951,7 @@ public:
// add some render rows
static const LAYER_WIDGET::ROW renderRows[] = {
- LAYER_WIDGET::ROW( wxT("With Very Large Ears"), 0, UNSPECIFIED_COLOR, wxT("Spock here") ),
+ LAYER_WIDGET::ROW( wxT("With Very Large Ears"), 0, UNSPECIFIED_COLOR4D, wxT("Spock here") ),
LAYER_WIDGET::ROW( wxT("With Legs"), 1, YELLOW ),
LAYER_WIDGET::ROW( wxT("With Oval Eyes"), 1, BROWN, wxT("My eyes are upon you") ),
};
diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h
index e35be8e275..de4a33c95f 100644
--- a/pcbnew/layer_widget.h
+++ b/pcbnew/layer_widget.h
@@ -42,7 +42,7 @@
#include
#include
#include
-#include
+#include
#define LYR_COLUMN_COUNT 4 ///< Layer tab column count
#define RND_COLUMN_COUNT 2 ///< Rendering tab column count
@@ -52,6 +52,7 @@
#define COLUMN_COLOR_LYR_CB 2
#define COLUMN_COLOR_LYRNAME 3
+using KIGFX::COLOR4D;
/**
* Class LAYER_WIDGET
@@ -84,11 +85,11 @@ public:
{
wxString rowName; ///< the prompt or layername
int id; ///< either a layer or "visible element" id
- EDA_COLOR_T color; ///< -1 if none.
+ COLOR4D color; ///< UNSPECIFIED_COLOR4D if none.
bool state; ///< initial wxCheckBox state
wxString tooltip; ///< if not empty, use this tooltip on row
- ROW( const wxString& aRowName, int aId, EDA_COLOR_T aColor = UNSPECIFIED_COLOR,
+ ROW( const wxString& aRowName, int aId, COLOR4D aColor = UNSPECIFIED_COLOR4D,
const wxString& aTooltip = wxEmptyString, bool aState = true )
{
rowName = aRowName;
@@ -120,7 +121,7 @@ protected:
int m_CurrentRow; ///< selected row of layer list
int m_PointSize;
- static wxBitmap makeBitmap( EDA_COLOR_T aColor );
+ static wxBitmap makeBitmap( COLOR4D aColor );
/**
* Virtual Function useAlternateBitmap
@@ -132,6 +133,12 @@ protected:
*/
virtual bool useAlternateBitmap(int aRow) { return false; }
+ /**
+ * Subclasses can override this to provide logic for allowing
+ * arbitrary color selection via wxColourPicker instead of DisplayColorFrame.
+ */
+ virtual bool AreArbitraryColorsAllowed() { return false; }
+
/**
* Function encodeId
* is here to allow saving a layer index within a control as its wxControl id,
@@ -153,7 +160,7 @@ protected:
* Function makeColorButton
* creates a wxBitmapButton and assigns it a solid color and a control ID
*/
- wxBitmapButton* makeColorButton( wxWindow* aParent, EDA_COLOR_T aColor, int aID );
+ wxBitmapButton* makeColorButton( wxWindow* aParent, COLOR4D aColor, int aID );
void OnLeftDownLayers( wxMouseEvent& event );
@@ -332,13 +339,13 @@ public:
* Function SetLayerColor
* changes the color of \a aLayer
*/
- void SetLayerColor( LAYER_NUM aLayer, EDA_COLOR_T aColor );
+ void SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor );
/**
* Function GetLayerColor
* returns the color of the layer ROW associated with \a aLayer id.
*/
- EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const;
+ COLOR4D GetLayerColor( LAYER_NUM aLayer ) const;
/**
* Function SetRenderState
@@ -385,7 +392,7 @@ public:
* @param aLayer is the board layer to change
* @param aColor is the new color
*/
- virtual void OnLayerColorChange( int aLayer, EDA_COLOR_T aColor ) = 0;
+ virtual void OnLayerColorChange( int aLayer, COLOR4D aColor ) = 0;
/**
* Function OnLayerSelect
@@ -416,7 +423,7 @@ public:
* via the AddRenderRow() function.
* @param aColor is the new color
*/
- virtual void OnRenderColorChange( int aId, EDA_COLOR_T aColor ) = 0;
+ virtual void OnRenderColorChange( int aId, COLOR4D aColor ) = 0;
/**
* Function OnRenderEnable
diff --git a/pcbnew/modedit.cpp b/pcbnew/modedit.cpp
index 7c72dc0ab9..2a69f0ddcb 100644
--- a/pcbnew/modedit.cpp
+++ b/pcbnew/modedit.cpp
@@ -969,7 +969,7 @@ void FOOTPRINT_EDIT_FRAME::OnVerticalToolbar( wxCommandEvent& aEvent )
}
-EDA_COLOR_T FOOTPRINT_EDIT_FRAME::GetGridColor() const
+COLOR4D FOOTPRINT_EDIT_FRAME::GetGridColor() const
{
return g_ColorsSettings.GetItemColor( GRID_VISIBLE );
}
diff --git a/pcbnew/module_editor_frame.h b/pcbnew/module_editor_frame.h
index eee7155169..d89a701b6c 100644
--- a/pcbnew/module_editor_frame.h
+++ b/pcbnew/module_editor_frame.h
@@ -448,7 +448,7 @@ public:
* Function GetGridColor() , virtual
* @return the color of the grid
*/
- virtual EDA_COLOR_T GetGridColor() const override;
+ virtual COLOR4D GetGridColor() const override;
///> @copydoc PCB_BASE_FRAME::SetActiveLayer()
void SetActiveLayer( LAYER_ID aLayer ) override;
diff --git a/pcbnew/modview_frame.cpp b/pcbnew/modview_frame.cpp
index 2b7f9ea526..5e21d39c06 100644
--- a/pcbnew/modview_frame.cpp
+++ b/pcbnew/modview_frame.cpp
@@ -680,7 +680,7 @@ void FOOTPRINT_VIEWER_FRAME::Update3D_Frame( bool aForceReloadFootprint )
}
-EDA_COLOR_T FOOTPRINT_VIEWER_FRAME::GetGridColor() const
+COLOR4D FOOTPRINT_VIEWER_FRAME::GetGridColor() const
{
return g_ColorsSettings.GetItemColor( GRID_VISIBLE );
}
diff --git a/pcbnew/modview_frame.h b/pcbnew/modview_frame.h
index ca347af875..9c6ce27c56 100644
--- a/pcbnew/modview_frame.h
+++ b/pcbnew/modview_frame.h
@@ -52,7 +52,7 @@ protected:
public:
~FOOTPRINT_VIEWER_FRAME();
- virtual EDA_COLOR_T GetGridColor() const override;
+ virtual COLOR4D GetGridColor() const override;
/**
* Function ReCreateLibraryList
diff --git a/pcbnew/pcb_painter.cpp b/pcbnew/pcb_painter.cpp
index 22060521e9..24fa470f1a 100644
--- a/pcbnew/pcb_painter.cpp
+++ b/pcbnew/pcb_painter.cpp
@@ -64,10 +64,10 @@ PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
void PCB_RENDER_SETTINGS::ImportLegacyColors( const COLORS_DESIGN_SETTINGS* aSettings )
{
for( int i = 0; i < LAYER_ID_COUNT; i++ )
- m_layerColors[i] = m_legacyColorMap[aSettings->GetLayerColor( i )];
+ m_layerColors[i] = aSettings->GetLayerColor( i );
for( int i = 0; i < END_PCB_VISIBLE_LIST; i++ )
- m_layerColors[ITEM_GAL_LAYER( i )] = m_legacyColorMap[aSettings->GetItemColor( i )];
+ m_layerColors[ITEM_GAL_LAYER( i )] = aSettings->GetItemColor( i );
m_layerColors[ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE )] = m_layerColors[F_SilkS];
m_layerColors[ITEM_GAL_LAYER( MOD_TEXT_BK_VISIBLE )] = m_layerColors[B_SilkS];
diff --git a/pcbnew/pcb_plot_params.h b/pcbnew/pcb_plot_params.h
index 8559ef7d86..1e17071d0c 100644
--- a/pcbnew/pcb_plot_params.h
+++ b/pcbnew/pcb_plot_params.h
@@ -152,9 +152,9 @@ private:
int m_HPGLPenNum; ///< HPGL only: pen number selection(1 to 9)
int m_HPGLPenSpeed; ///< HPGL only: pen speed, always in cm/s (1 to 99 cm/s)
int m_HPGLPenDiam; ///< HPGL only: pen diameter in MILS, useful to fill areas
- EDA_COLOR_T m_color; ///< Color for plotting the current layer
- EDA_COLOR_T m_referenceColor; ///< Color for plotting references
- EDA_COLOR_T m_valueColor; ///< Color for plotting values
+ COLOR4D m_color; ///< Color for plotting the current layer
+ COLOR4D m_referenceColor; ///< Color for plotting references
+ COLOR4D m_valueColor; ///< Color for plotting values
public:
PCB_PLOT_PARAMS();
@@ -169,14 +169,14 @@ public:
bool operator==( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
bool operator!=( const PCB_PLOT_PARAMS &aPcbPlotParams ) const;
- void SetColor( EDA_COLOR_T aVal ) { m_color = aVal; }
- EDA_COLOR_T GetColor() const { return m_color; }
+ void SetColor( COLOR4D aVal ) { m_color = aVal; }
+ COLOR4D GetColor() const { return m_color; }
- void SetReferenceColor( EDA_COLOR_T aVal ) { m_referenceColor = aVal; }
- EDA_COLOR_T GetReferenceColor() const { return m_referenceColor; }
+ void SetReferenceColor( COLOR4D aVal ) { m_referenceColor = aVal; }
+ COLOR4D GetReferenceColor() const { return m_referenceColor; }
- void SetValueColor( EDA_COLOR_T aVal ) { m_valueColor = aVal; }
- EDA_COLOR_T GetValueColor() const { return m_valueColor; }
+ void SetValueColor( COLOR4D aVal ) { m_valueColor = aVal; }
+ COLOR4D GetValueColor() const { return m_valueColor; }
void SetTextMode( PlotTextMode aVal ) { m_textMode = aVal; }
PlotTextMode GetTextMode() const { return m_textMode; }
diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp
index bccdf8bf62..b0761fa8f3 100644
--- a/pcbnew/pcbframe.cpp
+++ b/pcbnew/pcbframe.cpp
@@ -718,6 +718,37 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
PCB_BASE_EDIT_FRAME::UseGalCanvas( aEnable );
enableGALSpecificMenus();
+
+ // Force colors to be legacy-compatible in case they were changed in GAL
+ if( !aEnable )
+ {
+ forceColorsToLegacy();
+ Refresh();
+ }
+
+ // Re-create the layer manager to allow arbitrary colors when GAL is enabled
+ ReFillLayerWidget();
+ m_Layers->ReFillRender();
+}
+
+
+void PCB_EDIT_FRAME::forceColorsToLegacy()
+{
+ COLORS_DESIGN_SETTINGS *cds = GetBoard()->GetColorsSettings();
+
+ for( int i = 0; i < LAYER_ID_COUNT; i++ )
+ {
+ COLOR4D c = cds->GetLayerColor( i );
+ c.SetToNearestLegacyColor();
+ cds->SetLayerColor( i, c );
+ }
+
+ for( unsigned int i = 0; i < DIM( cds->m_ItemsColors ); i++ )
+ {
+ COLOR4D c = cds->GetItemColor( i );
+ c.SetToNearestLegacyColor();
+ cds->SetItemColor( i, c );
+ }
}
@@ -818,26 +849,20 @@ void PCB_EDIT_FRAME::SetGridVisibility(bool aVisible)
}
-EDA_COLOR_T PCB_EDIT_FRAME::GetGridColor() const
+COLOR4D PCB_EDIT_FRAME::GetGridColor() const
{
return GetBoard()->GetVisibleElementColor( GRID_VISIBLE );
}
-void PCB_EDIT_FRAME::SetGridColor( EDA_COLOR_T aColor )
+void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor )
{
GetBoard()->SetVisibleElementColor( GRID_VISIBLE, aColor );
if( IsGalCanvasActive() )
{
- StructColors c = g_ColorRefs[ aColor ];
- KIGFX::COLOR4D color( (double) c.m_Red / 255.0,
- (double) c.m_Green / 255.0,
- (double) c.m_Blue / 255.0,
- 0.7 );
-
- GetGalCanvas()->GetGAL()->SetGridColor( color );
+ GetGalCanvas()->GetGAL()->SetGridColor( aColor );
}
}
diff --git a/pcbnew/pcbplot.h b/pcbnew/pcbplot.h
index 602f3bac00..d20483303c 100644
--- a/pcbnew/pcbplot.h
+++ b/pcbnew/pcbplot.h
@@ -104,7 +104,7 @@ public:
void SetLayerSet( LSET aLayerMask ) { m_layerMask = aLayerMask; }
void Plot_Edges_Modules();
void Plot_1_EdgeModule( EDGE_MODULE* aEdge );
- void PlotTextModule( TEXTE_MODULE* aTextMod, EDA_COLOR_T aColor );
+ void PlotTextModule( TEXTE_MODULE* aTextMod, COLOR4D aColor );
/*
* Plot field of a module (footprint)
@@ -127,7 +127,7 @@ public:
* and be drawn as a non filled item although the plot mode is filled
* color and plot mode are needed by this function
*/
- void PlotPad( D_PAD* aPad, EDA_COLOR_T aColor, EDA_DRAW_MODE_T aPlotMode );
+ void PlotPad( D_PAD* aPad, COLOR4D aColor, EDA_DRAW_MODE_T aPlotMode );
/**
* plot items like text and graphics,
@@ -151,7 +151,7 @@ public:
* and in B&W mode, is plotted as white but other colors are plotted in BLACK
* so the returned color is LIGHTGRAY when the layer color is WHITE
*/
- EDA_COLOR_T getColor( LAYER_NUM aLayer );
+ COLOR4D getColor( LAYER_NUM aLayer );
private:
/** Helper function to plot a single drill mark. It compensate and clamp
diff --git a/pcbnew/plot_board_layers.cpp b/pcbnew/plot_board_layers.cpp
index e01bba777a..87113789ef 100644
--- a/pcbnew/plot_board_layers.cpp
+++ b/pcbnew/plot_board_layers.cpp
@@ -98,13 +98,13 @@ void PlotSilkScreen( BOARD *aBoard, PLOTTER* aPlotter, LSET aLayerMask,
if( !( masklayer & layersmask_plotpads ).any() )
continue;
- EDA_COLOR_T color = ColorFromInt( 0 );
+ COLOR4D color = COLOR4D_BLACK;
if( layersmask_plotpads[B_SilkS] )
color = aBoard->GetLayerColor( B_SilkS );
if( layersmask_plotpads[F_SilkS] )
- color = ColorFromInt( color | aBoard->GetLayerColor( F_SilkS ) );
+ color = ( color == COLOR4D_BLACK) ? aBoard->GetLayerColor( F_SilkS ) : color;
itemplotter.PlotPad( pad, color, SKETCH );
}
@@ -408,13 +408,13 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
if( padPlotsSize.x <= 0 || padPlotsSize.y <= 0 )
continue;
- EDA_COLOR_T color = BLACK;
+ COLOR4D color = COLOR4D_BLACK;
if( pad->GetLayerSet()[B_Cu] )
color = aBoard->GetVisibleElementColor( PAD_BK_VISIBLE );
if( pad->GetLayerSet()[F_Cu] )
- color = ColorFromInt( color | aBoard->GetVisibleElementColor( PAD_FR_VISIBLE ) );
+ color = color.LegacyMix( aBoard->GetVisibleElementColor( PAD_FR_VISIBLE ) );
// Temporary set the pad size to the required plot size:
wxSize tmppadsize = pad->GetSize();
@@ -507,7 +507,7 @@ void PlotStandardLayer( BOARD *aBoard, PLOTTER* aPlotter,
gbr_metadata.SetNetName( Via->GetNetname() );
- EDA_COLOR_T color = aBoard->GetVisibleElementColor(VIAS_VISIBLE + Via->GetViaType());
+ COLOR4D color = aBoard->GetVisibleElementColor( VIAS_VISIBLE + Via->GetViaType() );
// Set plot color (change WHITE to LIGHTGRAY because
// the white items are not seen on a white paper or screen
aPlotter->SetColor( color != WHITE ? color : LIGHTGRAY);
diff --git a/pcbnew/plot_brditems_plotter.cpp b/pcbnew/plot_brditems_plotter.cpp
index 12fce73a87..91c4bd0958 100644
--- a/pcbnew/plot_brditems_plotter.cpp
+++ b/pcbnew/plot_brditems_plotter.cpp
@@ -54,16 +54,16 @@
* and a group of board items
*/
-EDA_COLOR_T BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer )
+COLOR4D BRDITEMS_PLOTTER::getColor( LAYER_NUM aLayer )
{
- EDA_COLOR_T color = m_board->GetLayerColor( ToLAYER_ID( aLayer ) );
- if (color == WHITE)
- color = LIGHTGRAY;
+ COLOR4D color = m_board->GetLayerColor( ToLAYER_ID( aLayer ) );
+ if( color == COLOR4D_WHITE )
+ color = COLOR4D( LIGHTGRAY );
return color;
}
-void BRDITEMS_PLOTTER::PlotPad( D_PAD* aPad, EDA_COLOR_T aColor, EDA_DRAW_MODE_T aPlotMode )
+void BRDITEMS_PLOTTER::PlotPad( D_PAD* aPad, COLOR4D aColor, EDA_DRAW_MODE_T aPlotMode )
{
wxPoint shape_pos = aPad->ShapePos();
GBR_METADATA gbr_metadata;
@@ -223,7 +223,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
// Plot text fields, if allowed
if( trace_ref )
{
- if( GetReferenceColor() == UNSPECIFIED_COLOR )
+ if( GetReferenceColor() == UNSPECIFIED_COLOR4D )
PlotTextModule( &aModule->Reference(), getColor( textLayer ) );
else
PlotTextModule( &aModule->Reference(), GetReferenceColor() );
@@ -231,7 +231,7 @@ bool BRDITEMS_PLOTTER::PlotAllTextsModule( MODULE* aModule )
if( trace_val )
{
- if( GetValueColor() == UNSPECIFIED_COLOR )
+ if( GetValueColor() == UNSPECIFIED_COLOR4D )
PlotTextModule( &aModule->Value(), getColor( textLayer ) );
else
PlotTextModule( &aModule->Value(), GetValueColor() );
@@ -292,15 +292,15 @@ void BRDITEMS_PLOTTER::PlotBoardGraphicItems()
}
}
-void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, EDA_COLOR_T aColor )
+void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, COLOR4D aColor )
{
wxSize size;
wxPoint pos;
double orient;
int thickness;
- if( aColor == WHITE )
- aColor = LIGHTGRAY;
+ if( aColor == COLOR4D_WHITE )
+ aColor = COLOR4D( LIGHTGRAY );
m_plotter->SetColor( aColor );
@@ -344,7 +344,7 @@ void BRDITEMS_PLOTTER::PlotDimension( DIMENSION* aDim )
draw.SetWidth( aDim->GetWidth() );
draw.SetLayer( aDim->GetLayer() );
- EDA_COLOR_T color = aDim->GetBoard()->GetLayerColor( aDim->GetLayer() );
+ COLOR4D color = aDim->GetBoard()->GetLayerColor( aDim->GetLayer() );
// Set plot color (change WHITE to LIGHTGRAY because
// the white items are not seen on a white paper or screen
@@ -591,14 +591,14 @@ void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
for( unsigned ii = 0; ii < strings_list.Count(); ii++ )
{
wxString& txt = strings_list.Item( ii );
- m_plotter->Text( positions[ii], UNSPECIFIED_COLOR, txt, orient, size,
+ m_plotter->Text( positions[ii], UNSPECIFIED_COLOR4D, txt, orient, size,
pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(),
thickness, pt_texte->IsItalic(), allow_bold, false, &gbr_metadata );
}
}
else
{
- m_plotter->Text( pos, UNSPECIFIED_COLOR, shownText, orient, size,
+ m_plotter->Text( pos, UNSPECIFIED_COLOR4D, shownText, orient, size,
pt_texte->GetHorizJustify(), pt_texte->GetVertJustify(),
thickness, pt_texte->IsItalic(), allow_bold, false, &gbr_metadata );
}
diff --git a/pcbnew/print_board_functions.cpp b/pcbnew/print_board_functions.cpp
index 47291edb06..00aef8b8f8 100644
--- a/pcbnew/print_board_functions.cpp
+++ b/pcbnew/print_board_functions.cpp
@@ -223,7 +223,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
int radius = track->GetWidth() / 2;
const VIA* via = static_cast( track );
- EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->GetViaType() );
+ COLOR4D color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + via->GetViaType() );
GRFilledCircle( m_canvas->GetClipBox(), aDC,
via->GetStart().x,
@@ -272,7 +272,7 @@ void PCB_EDIT_FRAME::PrintPage( wxDC* aDC,
if( drillShapeOpt != PRINT_PARAMETERS::NO_DRILL_SHAPE )
{
TRACK* track = Pcb->m_Track;
- EDA_COLOR_T color = WHITE;
+ COLOR4D color = COLOR4D_WHITE;
bool blackpenstate = GetGRForceBlackPenState();
diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp
index f49c0e663c..1e5563392a 100644
--- a/pcbnew/printout_controler.cpp
+++ b/pcbnew/printout_controler.cpp
@@ -282,7 +282,7 @@ void BOARD_PRINTOUT_CONTROLLER::DrawPage( const wxString& aLayerName, int aPageN
panel->SetClipBox( EDA_RECT( wxPoint( 0, 0 ), wxSize( MAX_VALUE, MAX_VALUE ) ) );
screen->m_IsPrinting = true;
- EDA_COLOR_T bg_color = m_Parent->GetDrawBgColor();
+ COLOR4D bg_color = m_Parent->GetDrawBgColor();
// Print frame reference, if requested, before
if( m_PrintParams.m_Print_Black_and_White )
diff --git a/pcbnew/ratsnest.cpp b/pcbnew/ratsnest.cpp
index f36a88524f..0015185456 100644
--- a/pcbnew/ratsnest.cpp
+++ b/pcbnew/ratsnest.cpp
@@ -756,7 +756,7 @@ void PCB_BASE_FRAME::TraceModuleRatsNest( wxDC* DC )
if( ( m_Pcb->m_Status_Pcb & RATSNEST_ITEM_LOCAL_OK ) == 0 )
return;
- EDA_COLOR_T tmpcolor = g_ColorsSettings.GetItemColor(RATSNEST_VISIBLE);
+ COLOR4D tmpcolor = g_ColorsSettings.GetItemColor( RATSNEST_VISIBLE );
for( unsigned ii = 0; ii < m_Pcb->m_LocalRatsnest.size(); ii++ )
{
diff --git a/pcbnew/router/router_preview_item.cpp b/pcbnew/router/router_preview_item.cpp
index 7eaf0bc636..abd46092da 100644
--- a/pcbnew/router/router_preview_item.cpp
+++ b/pcbnew/router/router_preview_item.cpp
@@ -27,7 +27,6 @@
#include "class_track.h"
#include
-#include
#include "router_preview_item.h"
diff --git a/pcbnew/sel_layer.cpp b/pcbnew/sel_layer.cpp
index 44fad09c6d..63b965447f 100644
--- a/pcbnew/sel_layer.cpp
+++ b/pcbnew/sel_layer.cpp
@@ -59,7 +59,7 @@ protected:
// Returns a color index from the layer id
// Virtual function
- EDA_COLOR_T GetLayerColor( LAYER_NUM aLayer ) const override
+ COLOR4D GetLayerColor( LAYER_NUM aLayer ) const override
{
return m_brd->GetLayerColor( ToLAYER_ID( aLayer ) );
}
@@ -138,7 +138,7 @@ void PCB_ONE_LAYER_SELECTOR::buildList()
if( m_notAllowedLayersMask[layerid] )
continue;
- wxColour color = MakeColour( GetLayerColor( layerid ) );
+ COLOR4D color = GetLayerColor( layerid );
layername = GetLayerName( layerid );
if( IsCopperLayer( layerid ) )
@@ -147,7 +147,7 @@ void PCB_ONE_LAYER_SELECTOR::buildList()
m_leftGridLayers->AppendRows( 1 );
m_leftGridLayers->SetCellBackgroundColour ( left_row, COLOR_COLNUM,
- color );
+ color.ToColour() );
m_leftGridLayers->SetCellValue( left_row, LAYERNAME_COLNUM,
layername );
@@ -156,7 +156,7 @@ void PCB_ONE_LAYER_SELECTOR::buildList()
m_leftGridLayers->SetCellValue( left_row, SELECT_COLNUM,
wxT("X") );
m_leftGridLayers->SetCellBackgroundColour ( left_row, SELECT_COLNUM,
- color );
+ color.ToColour() );
m_leftGridLayers->SetGridCursor( left_row, LAYERNAME_COLNUM );
}
@@ -169,7 +169,7 @@ void PCB_ONE_LAYER_SELECTOR::buildList()
m_rightGridLayers->AppendRows( 1 );
m_rightGridLayers->SetCellBackgroundColour ( right_row, COLOR_COLNUM,
- color );
+ color.ToColour() );
m_rightGridLayers->SetCellValue( right_row, LAYERNAME_COLNUM,
layername );
@@ -178,7 +178,7 @@ void PCB_ONE_LAYER_SELECTOR::buildList()
m_rightGridLayers->SetCellValue( right_row, SELECT_COLNUM,
wxT("X") );
m_rightGridLayers->SetCellBackgroundColour ( right_row, SELECT_COLNUM,
- color );
+ color.ToColour() );
m_rightGridLayers->SetGridCursor( right_row, LAYERNAME_COLNUM );
}
@@ -338,14 +338,14 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList()
if( !IsCopperLayer( layerid ) )
break;
- wxColour color = MakeColour( GetLayerColor( layerid ) );
+ COLOR4D color = GetLayerColor( layerid );
layername = GetLayerName( layerid );
if( row )
m_leftGridLayers->AppendRows( 1 );
- m_leftGridLayers->SetCellBackgroundColour( row, COLOR_COLNUM, color );
+ m_leftGridLayers->SetCellBackgroundColour( row, COLOR_COLNUM, color.ToColour() );
m_leftGridLayers->SetCellValue( row, LAYERNAME_COLNUM, layername );
m_layersId.push_back( layerid );
@@ -358,7 +358,7 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList()
if( row )
m_rightGridLayers->AppendRows( 1 );
m_rightGridLayers->SetCellBackgroundColour ( row, COLOR_COLNUM,
- color );
+ color.ToColour() );
m_rightGridLayers->SetCellValue( row, LAYERNAME_COLNUM,
layername );
@@ -384,9 +384,9 @@ void SELECT_COPPER_LAYERS_PAIR_DIALOG::SetGridCursor( wxGrid* aGrid, int aRow,
if( aEnable )
{
LAYER_ID layerid = m_layersId[aRow];
- wxColour color = MakeColour( GetLayerColor( layerid ) );
+ COLOR4D color = GetLayerColor( layerid );
aGrid->SetCellValue( aRow, SELECT_COLNUM, wxT("X") );
- aGrid->SetCellBackgroundColour( aRow, SELECT_COLNUM, color );
+ aGrid->SetCellBackgroundColour( aRow, SELECT_COLNUM, color.ToColour() );
aGrid->SetGridCursor( aRow, LAYERNAME_COLNUM );
}
else
diff --git a/pcbnew/swig/pcbnew.i b/pcbnew/swig/pcbnew.i
index 3a6ada43b6..6e9997c8d9 100644
--- a/pcbnew/swig/pcbnew.i
+++ b/pcbnew/swig/pcbnew.i
@@ -59,7 +59,7 @@ class BASE_SET {};
%{
#include
-#include
+#include
#include
@@ -103,7 +103,7 @@ HANDLE_EXCEPTIONS(PLUGIN::FootprintDelete)
%include
%include
%include
-%include
+%include
%include
diff --git a/pcbnew/swig/python_scripting.cpp b/pcbnew/swig/python_scripting.cpp
index ece4fcf7d6..af57668ded 100644
--- a/pcbnew/swig/python_scripting.cpp
+++ b/pcbnew/swig/python_scripting.cpp
@@ -34,7 +34,7 @@
#include
#include
#include
-#include
+#include
#include
#include
diff --git a/pcbnew/tool_pcb.cpp b/pcbnew/tool_pcb.cpp
index 102ac535f8..a1ffa0f31b 100644
--- a/pcbnew/tool_pcb.cpp
+++ b/pcbnew/tool_pcb.cpp
@@ -93,13 +93,13 @@ static const char s_BitmapLayerIcon[BM_LAYERICON_SIZE][BM_LAYERICON_SIZE] =
void PCB_EDIT_FRAME::PrepareLayerIndicator()
{
int ii, jj;
- EDA_COLOR_T active_layer_color, Route_Layer_TOP_color,
+ COLOR4D active_layer_color, Route_Layer_TOP_color,
Route_Layer_BOTTOM_color, via_color;
bool change = false;
bool first_call = LayerPairBitmap == NULL;
- static int previous_active_layer_color, previous_Route_Layer_TOP_color,
- previous_Route_Layer_BOTTOM_color, previous_via_color;
+ static COLOR4D previous_active_layer_color, previous_Route_Layer_TOP_color,
+ previous_Route_Layer_BOTTOM_color, previous_via_color;
/* get colors, and redraw bitmap button only on changes */
active_layer_color = GetBoard()->GetLayerColor(GetActiveLayer());
@@ -164,19 +164,19 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
{
default:
case 0:
- pen.SetColour( MakeColour( active_layer_color ) );
+ pen.SetColour( active_layer_color.ToColour() );
break;
case 1:
- pen.SetColour( MakeColour( Route_Layer_TOP_color) );
+ pen.SetColour( Route_Layer_TOP_color.ToColour() );
break;
case 2:
- pen.SetColour( MakeColour( Route_Layer_BOTTOM_color ) );
+ pen.SetColour( Route_Layer_BOTTOM_color.ToColour() );
break;
case 3:
- pen.SetColour( MakeColour( via_color ) );
+ pen.SetColour( via_color.ToColour() );
break;
}