diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 917c283a3f..3969e14f99 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -383,16 +383,20 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT; wxString renderName( aSpec.rowName ); + wxCheckBox* cb = nullptr; // column 1 - col = 1; - wxCheckBox* cb = new wxCheckBox( m_RenderScrolledWindow, encodeId( col, aSpec.id ), - aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); - shrinkFont( cb, m_PointSize ); - cb->SetValue( aSpec.state ); - cb->Enable( aSpec.changeable ); - cb->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LAYER_WIDGET::OnRenderCheckBox, this ); - cb->SetToolTip( aSpec.tooltip ); + if( !aSpec.spacer ) + { + col = 1; + cb = new wxCheckBox( m_RenderScrolledWindow, encodeId( col, aSpec.id ), + aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT ); + shrinkFont( cb, m_PointSize ); + cb->SetValue( aSpec.state ); + cb->Enable( aSpec.changeable ); + cb->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LAYER_WIDGET::OnRenderCheckBox, this ); + cb->SetToolTip( aSpec.tooltip ); + } // column 0 col = 0; @@ -422,7 +426,16 @@ void LAYER_WIDGET::insertRenderRow( int aRow, const ROW& aSpec ) // Items have to be inserted in order col = 1; - m_RenderFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags ); + + if( aSpec.spacer ) + { + wxPanel* invisible = new wxPanel( m_RenderScrolledWindow, wxID_ANY ); + m_RenderFlexGridSizer->wxSizer::Insert( index+col, invisible, 0, flags ); + } + else + { + m_RenderFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags ); + } } @@ -541,7 +554,7 @@ wxSize LAYER_WIDGET::GetBestSize() const } // Account for the parent's frame: - totWidth += 10; + totWidth += 32; /* The minimum height is a small size to properly force computation @@ -567,7 +580,7 @@ wxSize LAYER_WIDGET::GetBestSize() const } } // account for the parent's frame, this one has void space of 10 PLUS a border: - totWidth += 20; + totWidth += 32; // For totHeight re-use the previous small one wxSize renderz( totWidth, totHeight ); diff --git a/pcbnew/layer_widget.h b/pcbnew/layer_widget.h index 902988b4ba..e80206110e 100644 --- a/pcbnew/layer_widget.h +++ b/pcbnew/layer_widget.h @@ -92,6 +92,7 @@ public: bool state; ///< initial wxCheckBox state wxString tooltip; ///< if not empty, use this tooltip on row bool changeable; ///< if true, the state can be changed + bool spacer; ///< if true, this row is a spacer ROW( const wxString& aRowName, int aId, COLOR4D aColor = COLOR4D::UNSPECIFIED, const wxString& aTooltip = wxEmptyString, bool aState = true, bool aChangeable = true ) @@ -103,6 +104,13 @@ public: tooltip = aTooltip; changeable = aChangeable; } + + ROW() + { + spacer = true; + color = COLOR4D::UNSPECIFIED; + id = 0; + } }; static const wxEventType EVT_LAYER_COLOR_CHANGE; diff --git a/pcbnew/pcb_layer_widget.cpp b/pcbnew/pcb_layer_widget.cpp index 2bc622d154..072431648b 100644 --- a/pcbnew/pcb_layer_widget.cpp +++ b/pcbnew/pcb_layer_widget.cpp @@ -64,31 +64,30 @@ const LAYER_WIDGET::ROW PCB_LAYER_WIDGET::s_render_rows[] = { #define NOCOLOR COLOR4D::UNSPECIFIED // specify rows that do not have a color selector icon // text id color tooltip + RR( _( "Footprints Front" ),LAYER_MOD_FR, NOCOLOR, _( "Show footprints that are on board's front") ), + RR( _( "Footprints Back" ), LAYER_MOD_BK, NOCOLOR, _( "Show footprints that are on board's back") ), + RR( _( "Values" ), LAYER_MOD_VALUES, NOCOLOR, _( "Show footprint values") ), + RR( _( "References" ), LAYER_MOD_REFERENCES, NOCOLOR, _( "Show footprint references") ), + RR( _( "Text Front" ), LAYER_MOD_TEXT_FR, NOCOLOR, _( "Show footprint text on board's front" ) ), + RR( _( "Text Back" ), LAYER_MOD_TEXT_BK, NOCOLOR, _( "Show footprint text on board's back" ) ), + RR( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ), + RR( _( "Pads Front" ), LAYER_PAD_FR, WHITE, _( "Show footprint pads on board's front" ) ), + RR( _( "Pads Back" ), LAYER_PAD_BK, WHITE, _( "Show footprint pads on board's back" ) ), + RR( _( "Through Hole Pads" ),LAYER_PADS_TH, YELLOW, _( "Show through hole pads in specific color") ), + RR(), RR( _( "Tracks" ), LAYER_TRACKS, NOCOLOR, _( "Show tracks" ) ), RR( _( "Through Via" ), LAYER_VIA_THROUGH, WHITE, _( "Show through vias" ) ), RR( _( "Bl/Buried Via" ), LAYER_VIA_BBLIND, WHITE, _( "Show blind or buried vias" ) ), RR( _( "Micro Via" ), LAYER_VIA_MICROVIA, WHITE, _( "Show micro vias") ), RR( _( "Non Plated Holes" ),LAYER_NON_PLATEDHOLES,WHITE, _( "Show non plated holes in specific color") ), + RR(), RR( _( "Ratsnest" ), LAYER_RATSNEST, WHITE, _( "Show unconnected nets as a ratsnest") ), - RR( _( "No-Connects" ), LAYER_NO_CONNECTS, BLUE, _( "Show a marker on pads which have no net connected" ) ), - RR( _( "Pads Front" ), LAYER_PAD_FR, WHITE, _( "Show footprint pads on board's front" ) ), - RR( _( "Through Hole Pads" ),LAYER_PADS_TH, YELLOW, _( "Show through hole pads in specific color") ), - RR( _( "Pads Back" ), LAYER_PAD_BK, WHITE, _( "Show footprint pads on board's back" ) ), - - RR( _( "Text Front" ), LAYER_MOD_TEXT_FR, NOCOLOR, _( "Show footprint text on board's front" ) ), - RR( _( "Text Back" ), LAYER_MOD_TEXT_BK, NOCOLOR, _( "Show footprint text on board's back" ) ), - RR( _( "Hidden Text" ), LAYER_MOD_TEXT_INVISIBLE, WHITE, _( "Show footprint text marked as invisible" ) ), - RR( _( "Anchors" ), LAYER_ANCHOR, WHITE, _( "Show footprint and text origins as a cross" ) ), - RR( _( "Grid" ), LAYER_GRID, WHITE, _( "Show the (x,y) grid dots" ) ), - RR( _( "Footprints Front" ),LAYER_MOD_FR, NOCOLOR, _( "Show footprints that are on board's front") ), - RR( _( "Footprints Back" ), LAYER_MOD_BK, NOCOLOR, _( "Show footprints that are on board's back") ), - RR( _( "Values" ), LAYER_MOD_VALUES, NOCOLOR, _( "Show footprint's values") ), - RR( _( "References" ), LAYER_MOD_REFERENCES, NOCOLOR, _( "Show footprint's references") ), RR( _( "Worksheet" ), LAYER_WORKSHEET, DARKRED, _( "Show worksheet") ), RR( _( "Cursor" ), LAYER_CURSOR, WHITE, _( "PCB Cursor" ), true, false ), - RR( _( "Aux items" ), LAYER_AUX_ITEMS, WHITE, _( "Auxillary items (rulers, assistants, axes, etc.)" ), true, false ), + RR( _( "Aux items" ), LAYER_AUX_ITEMS, WHITE, _( "Auxiliary items (rulers, assistants, axes, etc.)" ), true, false ), + RR( _( "Grid" ), LAYER_GRID, WHITE, _( "Show the (x,y) grid dots" ) ), RR( _( "Background" ), LAYER_PCB_BACKGROUND, BLACK, _( "PCB Background" ), true, false ) }; @@ -429,6 +428,9 @@ void PCB_LAYER_WIDGET::SyncRenderStates() if( m_fp_editor_mode && !isAllowedInFpMode( rowId ) ) continue; + if( s_render_rows[row].spacer ) + continue; + // this does not fire a UI event SetRenderState( rowId, board->IsElementVisible( static_cast( rowId ) ) ); }