Commit e7711122 authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio
Browse files

Enforced EDA_COLOR_T type and minor const-ification

parent 082d901d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,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, int aColor )
                           GR_DRAWMODE aDrawMode, EDA_COLOR_T aColor )
{

    int w = GetWidth();
+9 −9
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@
/* Initial colors values: optimized for Pcbnew, but are also Ok for Eeschema
 * these values are superseded by config reading
 */
static const int default_layer_color[LAYERSCOLORSBUFFERSIZE] =
static const EDA_COLOR_T default_layer_color[LAYERSCOLORSBUFFERSIZE] =
{
    GREEN,        BLUE,         LIGHTGRAY, BROWN,
    RED,          MAGENTA,      LIGHTGRAY, MAGENTA,
@@ -34,7 +34,7 @@ static const int default_layer_color[LAYERSCOLORSBUFFERSIZE] =
    DARKGRAY
};

static const int default_items_color[LAYERSCOLORSBUFFERSIZE] =
static const EDA_COLOR_T default_items_color[LAYERSCOLORSBUFFERSIZE] =
{
    LIGHTGRAY,  // unused
    CYAN,       // VIA_MICROVIA_VISIBLE
@@ -78,13 +78,13 @@ COLORS_DESIGN_SETTINGS:: COLORS_DESIGN_SETTINGS()
 * @return the color for aLayer which is one of the layer indices given
 * in pcbstruct.h or in schematic
 */
int COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer )
EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer ) const
{
    if( (unsigned) aLayer < DIM(m_LayersColors) )
    {
        return m_LayersColors[aLayer];
    }
    return -1;
    return UNSPECIFIED_COLOR;
}


@@ -93,7 +93,7 @@ int COLORS_DESIGN_SETTINGS::GetLayerColor( int aLayer )
 * sets the color for aLayer which is one of the layer indices given
 * in pcbstruct.h or in schematic
 */
void COLORS_DESIGN_SETTINGS::SetLayerColor( int aLayer, int aColor )
void COLORS_DESIGN_SETTINGS::SetLayerColor( int aLayer, EDA_COLOR_T aColor )
{
    if( (unsigned) aLayer < DIM(m_LayersColors) )
    {
@@ -107,13 +107,13 @@ void COLORS_DESIGN_SETTINGS::SetLayerColor( int aLayer, int aColor )
 * @return the color for an item which is one of the item indices given
 * in pcbstruct.h, enum PCB_VISIBLE or in schematic
 */
int COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx )
EDA_COLOR_T COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx )
{
    if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
    {
        return m_ItemsColors[aItemIdx];
    }
    return -1;
    return UNSPECIFIED_COLOR;
}


@@ -122,7 +122,7 @@ int COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx )
 * sets the color for an item which is one of the item indices given
 * in pcbstruct.h, enum PCB_VISIBLE or in schematic
 */
void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, int aColor )
void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, EDA_COLOR_T aColor )
{
    if( (unsigned) aItemIdx < DIM(m_ItemsColors) )
    {
@@ -136,7 +136,7 @@ void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, int aColor )
 * sets alls colors to aColor
 * Usefull to create a monochrome color selection for printing purpose
 */
void COLORS_DESIGN_SETTINGS::SetAllColorsAs( int aColor)
void COLORS_DESIGN_SETTINGS::SetAllColorsAs( EDA_COLOR_T aColor )
{
    for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
        m_LayersColors[ii] = aColor;
+3 −3
Original line number Diff line number Diff line
@@ -57,13 +57,13 @@ wxString g_Prj_Config_LocalFilename;

EDA_UNITS_T    g_UserUnit;

int            g_GhostColor;
EDA_COLOR_T    g_GhostColor;


#if defined(KICAD_GOST)
static bool s_gost = true;
static const bool s_gost = true;
#else
static bool s_gost = false;
static const bool s_gost = false;
#endif

bool IsGOST()
+5 −5
Original line number Diff line number Diff line
@@ -475,7 +475,7 @@ void EDA_DRAW_FRAME::OnGrid( int grid_type )
}


wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition )
wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
{
    wxPoint pos = aPosition;

@@ -553,7 +553,7 @@ void EDA_DRAW_FRAME::LoadSettings()
    int itmp;

    if( cfg->Read( m_FrameName + GridColorEntryKeyword, &itmp ) )
        SetGridColor( itmp );
        SetGridColor( ColorFromInt( itmp ) );

    cfg->Read( m_FrameName + LastGridSizeId, &m_LastGridSizeId, 0L );
}
@@ -575,7 +575,7 @@ void EDA_DRAW_FRAME::SaveSettings()

void EDA_DRAW_FRAME::AppendMsgPanel( const wxString& textUpper,
                                     const wxString& textLower,
                                     int color, int pad )
                                     EDA_COLOR_T color, int pad )
{
    if( m_messagePanel == NULL )
        return;
@@ -593,12 +593,12 @@ void EDA_DRAW_FRAME::ClearMsgPanel( void )
}


wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils )
wxString EDA_DRAW_FRAME::CoordinateToString( int aValue, bool aConvertToMils ) const
{
    return ::CoordinateToString( aValue, aConvertToMils );
}

wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMils )
wxString EDA_DRAW_FRAME::LengthDoubleToString( double aValue, bool aConvertToMils ) const
{
    return ::LengthDoubleToString( aValue, aConvertToMils );
}
+4 −4
Original line number Diff line number Diff line
@@ -153,7 +153,7 @@ BASE_SCREEN* EDA_DRAW_PANEL::GetScreen()
}


void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, int aColor )
void EDA_DRAW_PANEL::DrawCrossHair( wxDC* aDC, EDA_COLOR_T aColor )
{
    if( m_cursorLevel != 0 || aDC == NULL || !m_showCrossHair )
        return;
@@ -560,7 +560,7 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg )

void EDA_DRAW_PANEL::DrawBackGround( wxDC* DC )
{
    int          axis_color = BLUE;
    EDA_COLOR_T axis_color = BLUE;

    GRSetDrawMode( DC, GR_COPY );

@@ -721,7 +721,7 @@ void EDA_DRAW_PANEL::DrawAuxiliaryAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
    if( origin == wxPoint( 0, 0 ) )
        return;

    int     color    = DARKRED;
    EDA_COLOR_T color = DARKRED;
    wxSize  pageSize = GetParent()->GetPageSizeIU();

    GRSetDrawMode( aDC, aDrawMode );
@@ -752,7 +752,7 @@ void EDA_DRAW_PANEL::DrawGridAxis( wxDC* aDC, GR_DRAWMODE aDrawMode )
        || ( screen->m_GridOrigin.x == 0 && screen->m_GridOrigin.y == 0 ) )
        return;

    int     color    = GetParent()->GetGridColor();
    EDA_COLOR_T color = GetParent()->GetGridColor();
    wxSize  pageSize = GetParent()->GetPageSizeIU();

    GRSetDrawMode( aDC, aDrawMode );
Loading