diff --git a/3d-viewer/3d_draw.cpp b/3d-viewer/3d_draw.cpp index 9162f36706..c88a3a15cb 100644 --- a/3d-viewer/3d_draw.cpp +++ b/3d-viewer/3d_draw.cpp @@ -1084,8 +1084,8 @@ bool Is3DLayerEnabled( LAYER_NUM aLayer ) break; default: - // the layer was not a layer with a flag, so show it - return true; + // the layer was not a layer with a flag, so show it + return true; } // if the layer has a flag, return the flag diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 3d028f2ead..3ead91151e 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -174,7 +174,7 @@ int LAYER_WIDGET::encodeId( int aColumn, int aId ) } -int LAYER_WIDGET::getDecodedId( int aControlId ) +LAYER_NUM LAYER_WIDGET::getDecodedId( int aControlId ) { int id = aControlId / LYR_COLUMN_COUNT; // rounding is OK. return id; @@ -319,7 +319,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event ) wxBitmap bm = makeBitmap( newColor ); eventSource->SetBitmapLabel( bm ); - int id = getDecodedId( eventSource->GetId() ); + LAYER_NUM id = getDecodedId( eventSource->GetId() ); // tell the client code. OnRenderColorChange( id, newColor ); @@ -331,7 +331,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event ) void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event ) { wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject(); - int id = getDecodedId( eventSource->GetId() ); + LAYER_NUM id = getDecodedId( eventSource->GetId() ); OnRenderEnable( id, eventSource->IsChecked() ); passOnFocus(); } @@ -398,7 +398,7 @@ int LAYER_WIDGET::findRenderRow( int aId ) const void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) { - wxASSERT( aRow >= 0 && aRow < MAX_LAYER_ROWS ); + wxASSERT( aRow >= 0 ); int col; int index = aRow * LYR_COLUMN_COUNT; @@ -440,7 +440,7 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) { - wxASSERT( aRow >= 0 && aRow < MAX_LAYER_ROWS ); + wxASSERT( aRow >= 0 ); int col; int index = aRow * RND_COLUMN_COUNT; diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index a74a9e186b..151a1c4127 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -62,6 +62,10 @@ *

void OnLayerVisible( int aLayer, bool isVisible ); *

void OnRenderColorChange( int id, int aColor ); *

void OnRenderEnable( int id, bool isEnabled ); + * + * Please note that even if designed toward layers, it is used to + * contain other stuff, too (the second page in pcbnew contains render + * items, for example) */ class LAYER_WIDGET : public wxPanel { @@ -133,9 +137,11 @@ protected: /** * Function getDecodedId - * decodes \a aControlId to original un-encoded value. + * decodes \a aControlId to original un-encoded value. This of + * course holds iff encodedId was called with a LAYER_NUM (this box + * is used for other things than layers, too) */ - static int getDecodedId( int aControlId ); + static LAYER_NUM getDecodedId( int aControlId ); /** * Function makeColorButton @@ -243,8 +249,6 @@ public: */ void AppendLayerRow( const ROW& aRow ); -#define MAX_LAYER_ROWS 64 ///< cannot append more than this number of rows - /** * Function AppendLayerRows * appends new rows in the layer portion of the widget. The user must