7
mirror of https://gitlab.com/kicad/code/kicad.git synced 2025-04-14 15:59:36 +00:00

Replace DIM() macro

The standard DIM() macro was not typesafe as it happily deferred errors
to runtime that can be caught at compile time.  Replacing it with a
generic C++11 constexpr allows for typecasting, comparison and compile
time error checking.
This commit is contained in:
Seth Hillbrand 2019-01-06 08:43:12 -08:00
parent cec97ebfa6
commit 1e5ba6f1b1
49 changed files with 116 additions and 116 deletions

View File

@ -219,10 +219,10 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
layer_id.clear();
layer_id.reserve( m_copperLayersCount );
for( unsigned i = 0; i < DIM( cu_seq ); ++i )
for( unsigned i = 0; i < arrayDim( cu_seq ); ++i )
cu_seq[i] = ToLAYER_ID( B_Cu - i );
for( LSEQ cu = cu_set.Seq( cu_seq, DIM( cu_seq ) ); cu; ++cu )
for( LSEQ cu = cu_set.Seq( cu_seq, arrayDim( cu_seq ) ); cu; ++cu )
{
const PCB_LAYER_ID curr_layer_id = *cu;
@ -973,7 +973,7 @@ void CINFO3D_VISU::createLayers( REPORTER *aStatusTextReporter )
// User layers are not drawn here, only technical layers
for( LSEQ seq = LSET::AllNonCuMask().Seq( teckLayerList, DIM( teckLayerList ) );
for( LSEQ seq = LSET::AllNonCuMask().Seq( teckLayerList, arrayDim( teckLayerList ) );
seq;
++seq )
{

View File

@ -172,8 +172,8 @@ EDA_3D_VIEWER::EDA_3D_VIEWER( KIWAY *aKiway, PCB_BASE_FRAME *aParent,
// Create the status line
static const int status_dims[4] = { -1, 130, 130, 170 };
wxStatusBar *status_bar = CreateStatusBar( DIM( status_dims ) );
SetStatusWidths( DIM( status_dims ), status_dims );
wxStatusBar *status_bar = CreateStatusBar( arrayDim( status_dims ) );
SetStatusWidths( arrayDim( status_dims ), status_dims );
CreateMenuBar();
ReCreateMainToolbar();

View File

@ -75,7 +75,7 @@ const int COGL_ATT_LIST::m_openGL_attributes_list[] = {
#define ATT_WX_GL_SAMPLE_BUFFERS_DATA 11
int COGL_ATT_LIST::m_openGL_attributes_list_to_use[
DIM( COGL_ATT_LIST::m_openGL_attributes_list ) ] = { 0 };
arrayDim( COGL_ATT_LIST::m_openGL_attributes_list ) ] = { 0 };
const int *COGL_ATT_LIST::GetAttributesList( bool aUseAntiAliasing )

View File

@ -100,15 +100,15 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS( FRAME_T aFrameType )
m_frameType = aFrameType;
m_legacyMode = false;
for( unsigned src = 0, dst = 0; dst < DIM( m_LayersColors ); ++dst )
for( unsigned src = 0, dst = 0; dst < arrayDim( m_LayersColors ); ++dst )
{
m_LayersColors[dst] = COLOR4D( default_layer_color[src++] );
if( src >= DIM( default_layer_color ) )
if( src >= arrayDim( default_layer_color ) )
src = 0; // wrap the source.
}
for( unsigned src = 0, dst = LAYER_VIAS; src < DIM( default_items_color ); ++dst, ++src )
for( unsigned src = 0, dst = LAYER_VIAS; src < arrayDim( default_items_color ); ++dst, ++src )
{
m_LayersColors[dst] = COLOR4D( default_items_color[src] );
}
@ -125,7 +125,7 @@ COLORS_DESIGN_SETTINGS::COLORS_DESIGN_SETTINGS( FRAME_T aFrameType )
COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
{
if( (unsigned) aLayer < DIM( m_LayersColors ) )
if( (unsigned) aLayer < arrayDim( m_LayersColors ) )
{
return m_legacyMode ? m_LayersColors[aLayer].AsLegacyColor()
: m_LayersColors[aLayer];
@ -136,7 +136,7 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetLayerColor( LAYER_NUM aLayer ) const
void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
{
if( (unsigned) aLayer < DIM( m_LayersColors ) )
if( (unsigned) aLayer < arrayDim( m_LayersColors ) )
{
m_LayersColors[aLayer] = aColor;
}
@ -145,7 +145,7 @@ void COLORS_DESIGN_SETTINGS::SetLayerColor( LAYER_NUM aLayer, COLOR4D aColor )
COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
{
if( (unsigned) aItemIdx < DIM( m_LayersColors ) )
if( (unsigned) aItemIdx < arrayDim( m_LayersColors ) )
{
return m_legacyMode ? m_LayersColors[aItemIdx].AsLegacyColor()
: m_LayersColors[aItemIdx];
@ -157,7 +157,7 @@ COLOR4D COLORS_DESIGN_SETTINGS::GetItemColor( int aItemIdx ) const
void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, COLOR4D aColor )
{
if( (unsigned) aItemIdx < DIM( m_LayersColors ) )
if( (unsigned) aItemIdx < arrayDim( m_LayersColors ) )
{
m_LayersColors[aItemIdx] = aColor;
}
@ -166,7 +166,7 @@ void COLORS_DESIGN_SETTINGS::SetItemColor( int aItemIdx, COLOR4D aColor )
void COLORS_DESIGN_SETTINGS::SetAllColorsAs( COLOR4D aColor )
{
for( unsigned ii = 0; ii < DIM(m_LayersColors); ii++ )
for( unsigned ii = 0; ii < arrayDim(m_LayersColors); ii++ )
m_LayersColors[ii] = aColor;
}
@ -175,7 +175,7 @@ void COLORS_DESIGN_SETTINGS::SetAllColorsAs( COLOR4D aColor )
void COLORS_DESIGN_SETTINGS::setupConfigParams()
{
wxASSERT( DIM( m_LayersColors ) >= PCB_LAYER_ID_COUNT );
wxASSERT( arrayDim( m_LayersColors ) >= PCB_LAYER_ID_COUNT );
wxString currprefix = GetConfigPrefix();

View File

@ -26,7 +26,7 @@
*/
#include <fctsys.h>
#include <macros.h> // DIM()
#include <macros.h> // arrayDim()
#include <common.h>
#include <project.h>
#include <confirm.h>
@ -94,7 +94,7 @@ void EDA_DRAW_FRAME::Process_PageSettings( wxCommandEvent& event )
// units that do not allow too large draw areas
wxSize maxPageSize( MAX_PAGE_SIZE_EDITORS_MILS, MAX_PAGE_SIZE_EDITORS_MILS );
for( unsigned ii = 0; ii < DIM( smallSizeFrames ); ii++ )
for( unsigned ii = 0; ii < arrayDim( smallSizeFrames ); ii++ )
{
if( IsType( smallSizeFrames[ii] ) )
{
@ -157,7 +157,7 @@ void DIALOG_PAGES_SETTINGS::initDialog()
// The first shows translated strings, the second contains not translated strings
m_paperSizeComboBox->Clear();
for( unsigned ii = 0; ii < DIM(pageFmts); ii++ )
for( unsigned ii = 0; ii < arrayDim(pageFmts); ii++ )
{
m_pageFmt.Add( pageFmts[ii] );
m_paperSizeComboBox->Append( wxGetTranslation( pageFmts[ii] ) );
@ -721,7 +721,7 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
unsigned i;
for( i=0; i < DIM( papers ); ++i )
for( i=0; i < arrayDim( papers ); ++i )
{
if( paperType.Contains( papers[i] ) )
{
@ -730,7 +730,7 @@ void DIALOG_PAGES_SETTINGS::GetPageLayoutInfoFromDialog()
}
}
wxASSERT( i != DIM(papers) ); // dialog UI match the above list?
wxASSERT( i != arrayDim(papers) ); // dialog UI match the above list?
m_layout_size = pageInfo.GetSizeMils();

View File

@ -450,7 +450,7 @@ void EDA_BASE_FRAME::GetKicadHelp( wxCommandEvent& event )
wxString helpFile;
// Search for "getting_started_in_kicad.html" or "getting_started_in_kicad.pdf"
// or "Getting_Started_in_KiCad.html" or "Getting_Started_in_KiCad.pdf"
for( unsigned ii = 0; ii < DIM( names ); ii++ )
for( unsigned ii = 0; ii < arrayDim( names ); ii++ )
{
helpFile = SearchHelpFileFullPath( search, names[ii] );

View File

@ -103,7 +103,7 @@ bool GetAssociatedDocument( wxWindow* aParent,
wxT( "file:" )
};
for( unsigned ii = 0; ii < DIM(url_header); ii++ )
for( unsigned ii = 0; ii < arrayDim(url_header); ii++ )
{
if( aDocName.First( url_header[ii] ) == 0 ) // looks like an internet url
{

View File

@ -188,7 +188,7 @@ wxString FindKicadFile( const wxString& shortname )
};
// find binary file from possibilities list:
for( unsigned i=0; i<DIM(possibilities); ++i )
for( unsigned i=0; i<arrayDim(possibilities); ++i )
{
#ifndef __WXMAC__
fullFileName = possibilities[i] + shortname;
@ -309,7 +309,7 @@ wxString KicadDatasPath()
#endif
};
for( unsigned i=0; i<DIM(possibilities); ++i )
for( unsigned i=0; i<arrayDim(possibilities); ++i )
{
data_path = possibilities[i];

View File

@ -149,7 +149,7 @@ KIFACE* KIWAY::KiFACE( FACE_T aFaceId, bool doLoad )
{
// Since this will be called from python, cannot assume that code will
// not pass a bad aFaceId.
if( unsigned( aFaceId ) >= DIM( m_kiface ) )
if( unsigned( aFaceId ) >= arrayDim( m_kiface ) )
{
// @todo : throw an exception here for python's benefit, at least that
// way it gets some explanatory text.
@ -481,7 +481,7 @@ bool KIWAY::ProcessEvent( wxEvent& aEvent )
void KIWAY::OnKiwayEnd()
{
for( unsigned i=0; i < DIM( m_kiface ); ++i )
for( unsigned i=0; i < arrayDim( m_kiface ); ++i )
{
if( m_kiface[i] )
m_kiface[i]->OnKifaceEnd();

View File

@ -205,7 +205,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
};
SetStatusWidths( DIM( dims ), dims );
SetStatusWidths( arrayDim( dims ), dims );
// Create child subwindows.
GetClientSize( &m_FrameSize.x, &m_FrameSize.y );

View File

@ -207,7 +207,7 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
GetTextSize( wxT( "Add layer alignment target" ), stsbar ).x + 10,
};
SetStatusWidths( DIM( dims ), dims );
SetStatusWidths( arrayDim( dims ), dims );
// Create child subwindows.
GetClientSize( &m_FrameSize.x, &m_FrameSize.y );

View File

@ -185,7 +185,7 @@ LSEQ LSET::CuStack() const
B_Cu, // 31
};
return Seq( sequence, DIM( sequence ) );
return Seq( sequence, arrayDim( sequence ) );
}
@ -209,7 +209,7 @@ LSEQ LSET::Technicals( LSET aSetToOmit ) const
LSET subset = ~aSetToOmit & *this;
return subset.Seq( sequence, DIM( sequence ) );
return subset.Seq( sequence, arrayDim( sequence ) );
}
@ -225,7 +225,7 @@ LSEQ LSET::Users() const
Margin,
};
return Seq( sequence, DIM( sequence ) );
return Seq( sequence, arrayDim( sequence ) );
}
@ -252,7 +252,7 @@ LSEQ LSET::TechAndUserUIOrder() const
B_Fab,
};
return Seq( sequence, DIM( sequence ) );
return Seq( sequence, arrayDim( sequence ) );
}
@ -302,7 +302,7 @@ std::string LSET::FmtHex() const
if( nibble && !( nibble % 8 ) )
ret += '_';
assert( ndx < DIM( hex ) );
assert( ndx < arrayDim( hex ) );
ret += hex[ndx];
}
@ -468,7 +468,7 @@ LSEQ LSET::SeqStackupBottom2Top() const
Edge_Cuts,
};
return Seq( sequence, DIM( sequence ) );
return Seq( sequence, arrayDim( sequence ) );
}
@ -668,7 +668,7 @@ LSET LSET::InternalCuMask()
In30_Cu,
};
static const LSET saved( cu_internals, DIM( cu_internals ) );
static const LSET saved( cu_internals, arrayDim( cu_internals ) );
return saved;
}

View File

@ -56,7 +56,7 @@ static const VECTOR2I MarkerShapeCorners[] =
VECTOR2I( 1, 8 ),
VECTOR2I( 0, 0 )
};
const unsigned CORNERS_COUNT = DIM( MarkerShapeCorners );
const unsigned CORNERS_COUNT = arrayDim( MarkerShapeCorners );
/*******************/
/* Classe MARKER_BASE */

View File

@ -675,7 +675,7 @@ bool PGM_BASE::SetLanguage( bool first_time )
m_common_settings->Read( languageCfgKey, &languageSel );
// Search for the current selection
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
for( unsigned ii = 0; ii < arrayDim( s_Languages ); ii++ )
{
if( s_Languages[ii].m_Lang_Label == languageSel )
{
@ -717,7 +717,7 @@ bool PGM_BASE::SetLanguage( bool first_time )
wxString languageSel;
// Search for the current selection language name
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
for( unsigned ii = 0; ii < arrayDim( s_Languages ); ii++ )
{
if( s_Languages[ii].m_WX_Lang_Identifier == m_language_id )
{
@ -756,9 +756,9 @@ bool PGM_BASE::SetLanguage( bool first_time )
void PGM_BASE::SetLanguageIdentifier( int menu_id )
{
wxLogTrace( traceLocale, "Select language ID %d from %d possible languages.",
menu_id, DIM( s_Languages ) );
menu_id, arrayDim( s_Languages ) );
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
for( unsigned ii = 0; ii < arrayDim( s_Languages ); ii++ )
{
if( menu_id == s_Languages[ii].m_KI_Lang_Identifier )
{
@ -814,7 +814,7 @@ void PGM_BASE::AddMenuLanguageList( wxMenu* MasterMenu )
menu = new wxMenu;
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
for( unsigned ii = 0; ii < arrayDim( s_Languages ); ii++ )
{
wxString label;
@ -835,7 +835,7 @@ void PGM_BASE::AddMenuLanguageList( wxMenu* MasterMenu )
KiBitmap( language_xpm ) );
// Set Check mark on current selected language
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
for( unsigned ii = 0; ii < arrayDim( s_Languages ); ii++ )
{
if( m_language_id == s_Languages[ii].m_WX_Lang_Identifier )
menu->Check( s_Languages[ii].m_KI_Lang_Identifier, true );

View File

@ -48,7 +48,7 @@ void PROJECT::ElemsClear()
{
// careful here, this should work, but the virtual destructor may not
// be in the same link image as PROJECT.
for( unsigned i = 0; i < DIM( m_elems ); ++i )
for( unsigned i = 0; i < arrayDim( m_elems ); ++i )
{
SetElem( ELEM_T( i ), NULL );
}
@ -172,7 +172,7 @@ void PROJECT::SetRString( RSTRING_T aIndex, const wxString& aString )
{
unsigned ndx = unsigned( aIndex );
if( ndx < DIM( m_rstrings ) )
if( ndx < arrayDim( m_rstrings ) )
{
m_rstrings[ndx] = aString;
}
@ -187,7 +187,7 @@ const wxString& PROJECT::GetRString( RSTRING_T aIndex )
{
unsigned ndx = unsigned( aIndex );
if( ndx < DIM( m_rstrings ) )
if( ndx < arrayDim( m_rstrings ) )
{
return m_rstrings[ndx];
}
@ -206,7 +206,7 @@ PROJECT::_ELEM* PROJECT::GetElem( ELEM_T aIndex )
{
// This is virtual, so implement it out of line
if( unsigned( aIndex ) < DIM( m_elems ) )
if( unsigned( aIndex ) < arrayDim( m_elems ) )
{
return m_elems[aIndex];
}
@ -218,7 +218,7 @@ void PROJECT::SetElem( ELEM_T aIndex, _ELEM* aElem )
{
// This is virtual, so implement it out of line
if( unsigned( aIndex ) < DIM( m_elems ) )
if( unsigned( aIndex ) < arrayDim( m_elems ) )
{
#if defined(DEBUG) && 0
if( aIndex == ELEM_SCH_PART_LIBS )

View File

@ -268,7 +268,7 @@ bool isKeySpecialCode( int aKeyCode )
bool isInList = false;
for( unsigned ii = 0; ii < DIM( special_keys ) && !isInList; ii++ )
for( unsigned ii = 0; ii < arrayDim( special_keys ) && !isInList; ii++ )
{
if( special_keys[ii] == aKeyCode )
isInList = true;

View File

@ -322,7 +322,7 @@ protected:
{ SIDE_LEFT, pins_on_side( SIDE_LEFT ) },
{ SIDE_BOTTOM, pins_on_side( SIDE_BOTTOM ) },
};
std::vector<SIDE_AND_NPINS> sides( sides_init, sides_init + DIM( sides_init ) );
std::vector<SIDE_AND_NPINS> sides( sides_init, sides_init + arrayDim( sides_init ) );
int orient = m_component->GetOrientation();
int orient_angle = orient & 0xff; // enum is a bitmask
@ -386,7 +386,7 @@ protected:
std::vector<SIDE_AND_COLL> get_colliding_sides()
{
SIDE sides_init[] = { SIDE_RIGHT, SIDE_TOP, SIDE_LEFT, SIDE_BOTTOM };
std::vector<SIDE> sides( sides_init, sides_init + DIM( sides_init ) );
std::vector<SIDE> sides( sides_init, sides_init + arrayDim( sides_init ) );
std::vector<SIDE_AND_COLL> colliding;
// Iterate over all sides and find the ones that collide

View File

@ -174,7 +174,7 @@ static COLOR4D s_layerColor[LAYER_ID_COUNT];
COLOR4D GetLayerColor( SCH_LAYER_ID aLayer )
{
unsigned layer = ( aLayer );
wxASSERT( layer < DIM( s_layerColor ) );
wxASSERT( layer < arrayDim( s_layerColor ) );
return s_layerColor[layer];
}
@ -187,7 +187,7 @@ void SetLayerColor( COLOR4D aColor, SCH_LAYER_ID aLayer )
aColor.Darken( 0.01 );
unsigned layer = aLayer;
wxASSERT( layer < DIM( s_layerColor ) );
wxASSERT( layer < arrayDim( s_layerColor ) );
s_layerColor[layer] = aColor;
}

View File

@ -57,7 +57,7 @@ static const int pin_orientation_codes[] =
PIN_UP,
PIN_DOWN
};
#define PIN_ORIENTATION_CNT DIM( pin_orientation_codes )
#define PIN_ORIENTATION_CNT arrayDim( pin_orientation_codes )
// small margin in internal units between the pin text and the pin line
#define PIN_TEXT_MARGIN 4

View File

@ -99,10 +99,10 @@ SCH_SCREEN::SCH_SCREEN( KIWAY* aKiway ) :
SetZoom( 32 );
for( unsigned i = 0; i < DIM( SchematicZoomList ); i++ )
for( unsigned i = 0; i < arrayDim( SchematicZoomList ); i++ )
m_ZoomList.push_back( SchematicZoomList[i] );
for( unsigned i = 0; i < DIM( SchematicGridList ); i++ )
for( unsigned i = 0; i < arrayDim( SchematicGridList ); i++ )
AddGrid( SchematicGridList[i] );
SetGrid( wxRealPoint( 50, 50 ) ); // Default grid size.

View File

@ -41,7 +41,7 @@ bool PANEL_GERBVIEW_SETTINGS::TransferDataToWindow( )
m_BoxUnits->SetSelection( m_Parent->GetUserUnits() ? 1 : 0 );
m_ShowPageLimitsOpt->SetValue( m_Parent->m_DisplayOptions.m_DisplayPageLimits );
for( unsigned i = 0; i < DIM( g_GerberPageSizeList ); ++i )
for( unsigned i = 0; i < arrayDim( g_GerberPageSizeList ); ++i )
{
if( g_GerberPageSizeList[i] == m_Parent->GetPageSettings().GetType() )
{

View File

@ -103,10 +103,10 @@ static GRID_TYPE gbrGridList[] =
GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) :
BASE_SCREEN( SCREEN_T )
{
for( unsigned i = 0; i < DIM( gbrZoomList ); ++i )
for( unsigned i = 0; i < arrayDim( gbrZoomList ); ++i )
m_ZoomList.push_back( gbrZoomList[i] );
for( unsigned i = 0; i < DIM( gbrGridList ); ++i )
for( unsigned i = 0; i < arrayDim( gbrGridList ); ++i )
AddGrid( gbrGridList[i] );
// Set the working grid size to a reasonable value

View File

@ -101,7 +101,7 @@ GERBER_FILE_IMAGE::GERBER_FILE_IMAGE( int aLayer ) :
ResetDefaultValues();
for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ )
for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
m_Aperture_List[ii] = 0;
}
@ -110,7 +110,7 @@ GERBER_FILE_IMAGE::~GERBER_FILE_IMAGE()
{
m_Drawings.DeleteAll();
for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ )
for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
{
delete m_Aperture_List[ii];
}
@ -132,7 +132,7 @@ D_CODE* GERBER_FILE_IMAGE::GetDCODEOrCreate( int aDCODE, bool aCreateIfNoExist )
{
unsigned ndx = aDCODE - FIRST_DCODE;
if( ndx < (unsigned) DIM( m_Aperture_List ) )
if( ndx < (unsigned) arrayDim( m_Aperture_List ) )
{
// lazily create the D_CODE if it does not exist.
if( aCreateIfNoExist )
@ -152,7 +152,7 @@ D_CODE* GERBER_FILE_IMAGE::GetDCODE( int aDCODE ) const
{
unsigned ndx = aDCODE - FIRST_DCODE;
if( ndx < (unsigned) DIM( m_Aperture_List ) )
if( ndx < (unsigned) arrayDim( m_Aperture_List ) )
{
return m_Aperture_List[ndx];
}
@ -266,7 +266,7 @@ int GERBER_FILE_IMAGE::GetDcodesCount()
{
int count = 0;
for( unsigned ii = 0; ii < DIM( m_Aperture_List ); ii++ )
for( unsigned ii = 0; ii < arrayDim( m_Aperture_List ); ii++ )
{
if( m_Aperture_List[ii] )
if( m_Aperture_List[ii]->m_InUse || m_Aperture_List[ii]->m_Defined )

View File

@ -123,10 +123,10 @@ PARAM_CFG_ARRAY& GERBVIEW_FRAME::GetConfigurationSettings()
wxT("ColorLayer28Ex"), wxT("ColorLayer29Ex"), wxT("ColorLayer30Ex"), wxT("ColorLayer31Ex"),
};
wxASSERT( DIM(keys) == DIM(color_default) );
wxASSERT( DIM(keys) <= DIM(g_ColorsSettings.m_LayersColors) && DIM(keys) <= DIM(color_default) );
wxASSERT( arrayDim(keys) == arrayDim(color_default) );
wxASSERT( arrayDim(keys) <= arrayDim(g_ColorsSettings.m_LayersColors) && arrayDim(keys) <= arrayDim(color_default) );
for( unsigned i = 0; i < DIM(keys); ++i )
for( unsigned i = 0; i < arrayDim(keys); ++i )
{
COLOR4D* prm = &g_ColorsSettings.m_LayersColors[ GERBER_DRAW_LAYER( i ) ];

View File

@ -121,7 +121,7 @@ void GERBER_LAYER_WIDGET::ReFillRender()
RR( _( "Background" ), LAYER_PCB_BACKGROUND, BLACK, _( "PCB Background" ), true, false )
};
for( unsigned row=0; row<DIM(renderRows); ++row )
for( unsigned row=0; row<arrayDim(renderRows); ++row )
{
if( renderRows[row].color != COLOR4D::UNSPECIFIED ) // does this row show a color?
renderRows[row].color = myframe->GetVisibleElementColor( renderRows[row].id );
@ -130,7 +130,7 @@ void GERBER_LAYER_WIDGET::ReFillRender()
renderRows[row].state = myframe->IsElementVisible( renderRows[row].id );
}
AppendRenderRows( renderRows, DIM(renderRows) );
AppendRenderRows( renderRows, arrayDim(renderRows) );
}

Some files were not shown because too many files have changed in this diff Show More