Commit 9ebb4afa authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Removed arbitrary MAX_LAYER_ROWS limit (only used in one assertion, anyway)

parent 150cfebb
...@@ -1084,8 +1084,8 @@ bool Is3DLayerEnabled( LAYER_NUM aLayer ) ...@@ -1084,8 +1084,8 @@ bool Is3DLayerEnabled( LAYER_NUM aLayer )
break; break;
default: default:
// the layer was not a layer with a flag, so show it // the layer was not a layer with a flag, so show it
return true; return true;
} }
// if the layer has a flag, return the flag // if the layer has a flag, return the flag
......
...@@ -174,7 +174,7 @@ int LAYER_WIDGET::encodeId( int aColumn, int aId ) ...@@ -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. int id = aControlId / LYR_COLUMN_COUNT; // rounding is OK.
return id; return id;
...@@ -319,7 +319,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event ) ...@@ -319,7 +319,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event )
wxBitmap bm = makeBitmap( newColor ); wxBitmap bm = makeBitmap( newColor );
eventSource->SetBitmapLabel( bm ); eventSource->SetBitmapLabel( bm );
int id = getDecodedId( eventSource->GetId() ); LAYER_NUM id = getDecodedId( eventSource->GetId() );
// tell the client code. // tell the client code.
OnRenderColorChange( id, newColor ); OnRenderColorChange( id, newColor );
...@@ -331,7 +331,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event ) ...@@ -331,7 +331,7 @@ void LAYER_WIDGET::OnMiddleDownRenderColor( wxMouseEvent& event )
void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event ) void LAYER_WIDGET::OnRenderCheckBox( wxCommandEvent& event )
{ {
wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject(); wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
int id = getDecodedId( eventSource->GetId() ); LAYER_NUM id = getDecodedId( eventSource->GetId() );
OnRenderEnable( id, eventSource->IsChecked() ); OnRenderEnable( id, eventSource->IsChecked() );
passOnFocus(); passOnFocus();
} }
...@@ -398,7 +398,7 @@ int LAYER_WIDGET::findRenderRow( int aId ) const ...@@ -398,7 +398,7 @@ int LAYER_WIDGET::findRenderRow( int aId ) const
void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
{ {
wxASSERT( aRow >= 0 && aRow < MAX_LAYER_ROWS ); wxASSERT( aRow >= 0 );
int col; int col;
int index = aRow * LYR_COLUMN_COUNT; int index = aRow * LYR_COLUMN_COUNT;
...@@ -440,7 +440,7 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec ) ...@@ -440,7 +440,7 @@ void LAYER_WIDGET::insertLayerRow( int aRow, const ROW& aSpec )
void LAYER_WIDGET::insertRenderRow( 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 col;
int index = aRow * RND_COLUMN_COUNT; int index = aRow * RND_COLUMN_COUNT;
......
...@@ -62,6 +62,10 @@ ...@@ -62,6 +62,10 @@
* <p> void OnLayerVisible( int aLayer, bool isVisible ); * <p> void OnLayerVisible( int aLayer, bool isVisible );
* <p> void OnRenderColorChange( int id, int aColor ); * <p> void OnRenderColorChange( int id, int aColor );
* <p> void OnRenderEnable( int id, bool isEnabled ); * <p> 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 class LAYER_WIDGET : public wxPanel
{ {
...@@ -133,9 +137,11 @@ protected: ...@@ -133,9 +137,11 @@ protected:
/** /**
* Function getDecodedId * 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 * Function makeColorButton
...@@ -243,8 +249,6 @@ public: ...@@ -243,8 +249,6 @@ public:
*/ */
void AppendLayerRow( const ROW& aRow ); void AppendLayerRow( const ROW& aRow );
#define MAX_LAYER_ROWS 64 ///< cannot append more than this number of rows
/** /**
* Function AppendLayerRows * Function AppendLayerRows
* appends new rows in the layer portion of the widget. The user must * appends new rows in the layer portion of the widget. The user must
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment