KiCad PCB EDA Suite
LAYER_WIDGET Class Referenceabstract

Class LAYER_WIDGET is abstract and is used to manage a list of layers, with the notion of a "current" layer, and layer specific visibility control. More...

#include <layer_widget.h>

Inheritance diagram for LAYER_WIDGET:
GERBER_LAYER_WIDGET PCB_LAYER_WIDGET

Classes

struct  ROW
 Struct ROW provides all the data needed to add a row to a LAYER_WIDGET. More...
 

Public Member Functions

 LAYER_WIDGET (wxWindow *aParent, wxWindow *aFocusOwner, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 Constructor. More...
 
virtual ~LAYER_WIDGET ()
 
wxSize GetBestSize () const
 Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic content. More...
 
int GetLayerRowCount () const
 Function GetLayerRowCount returns the number of rows in the layer tab. More...
 
int GetRenderRowCount () const
 Function GetRenderRowCount returns the number of rows in the render tab. More...
 
void AppendLayerRow (const ROW &aRow)
 Function AppendLayerRow appends a new row in the layer portion of the widget. More...
 
void AppendLayerRows (const ROW *aRowsArray, int aRowCount)
 Function AppendLayerRows appends new rows in the layer portion of the widget. More...
 
void ClearLayerRows ()
 Function ClearLayerRows empties out the layer rows. More...
 
void AppendRenderRow (const ROW &aRow)
 Function AppendRenderRow appends a new row in the render portion of the widget. More...
 
void AppendRenderRows (const ROW *aRowsArray, int aRowCount)
 Function AppendRenderRows appends new rows in the render portion of the widget. More...
 
void ClearRenderRows ()
 Function ClearRenderRows empties out the render rows. More...
 
void SelectLayerRow (int aRow)
 Function SelectLayerRow changes the row selection in the layer list to the given row. More...
 
void SelectLayer (LAYER_NUM aLayer)
 Function SelectLayer changes the row selection in the layer list to aLayer provided. More...
 
LAYER_NUM GetSelectedLayer ()
 Function GetSelectedLayer returns the selected layer or -1 if none. More...
 
void SetLayerVisible (LAYER_NUM aLayer, bool isVisible)
 Function SetLayerVisible sets aLayer visible or not. More...
 
bool IsLayerVisible (LAYER_NUM aLayer)
 Function IsLayerVisible returns the visible state of the layer ROW associated with aLayer id. More...
 
void SetLayerColor (LAYER_NUM aLayer, COLOR4D aColor)
 Function SetLayerColor changes the color of aLayer. More...
 
COLOR4D GetLayerColor (LAYER_NUM aLayer) const
 Function GetLayerColor returns the color of the layer ROW associated with aLayer id. More...
 
void SetRenderState (int aId, bool isSet)
 Function SetRenderState sets the state of the checkbox associated with aId within the Render tab group of the widget. More...
 
bool GetRenderState (int aId)
 Function GetRenderState returns the state of the checkbox associated with aId. More...
 
void UpdateLayouts ()
 
void UpdateLayerIcons ()
 Function UpdateLayerIcons Update all layer manager icons (layers only) Useful when loading a file or clearing a layer because they change, and the indicator arrow icon needs to be updated. More...
 
virtual void OnLayerColorChange (int aLayer, COLOR4D aColor)=0
 Function OnLayerColorChange is called to notify client code about a layer color change. More...
 
virtual bool OnLayerSelect (int aLayer)=0
 Function OnLayerSelect is called to notify client code whenever the user selects a different layer. More...
 
virtual void OnLayerVisible (LAYER_NUM aLayer, bool isVisible, bool isFinal=true)=0
 Function OnLayerVisible is called to notify client code about a layer visibility change. More...
 
virtual void OnLayerRightClick (wxMenu &aMenu)=0
 Function OnLayerRightClick is called to notify client code about a layer being right-clicked. More...
 
virtual void OnRenderColorChange (int aId, COLOR4D aColor)=0
 Function OnRenderColorChange is called to notify client code whenever the user changes a rendering color. More...
 
virtual void OnRenderEnable (int aId, bool isEnabled)=0
 Function OnRenderEnable is called to notify client code whenever the user changes an rendering enable in one of the rendering checkboxes. More...
 

Static Public Attributes

static const wxEventType EVT_LAYER_COLOR_CHANGE = wxNewEventType()
 

Protected Types

enum  POPUP_ID { ID_CHANGE_LAYER_COLOR = wxID_HIGHEST, ID_CHANGE_RENDER_COLOR, ID_LAST_VALUE }
 

Protected Member Functions

virtual bool useAlternateBitmap (int aRow)
 Virtual Function useAlternateBitmap. More...
 
virtual bool AreArbitraryColorsAllowed ()
 Subclasses can override this to provide logic for allowing arbitrary color selection via wxColourPicker instead of DisplayColorFrame. More...
 
virtual COLOR4D getBackgroundLayerColor ()
 Subclasses can override this to provide accurate representation of transparent colour swatches. More...
 
void OnLeftDownLayers (wxMouseEvent &event)
 
void OnRightDownLayer (wxMouseEvent &event, COLOR_SWATCH *aColorSwatch, const wxString &aLayerName)
 Function OnRightDownLayer Called when user right-clicks a layer. More...
 
void OnLayerSwatchChanged (wxCommandEvent &aEvent)
 Function OnSwatchChanged() is called when a user changes a swatch color. More...
 
void OnLayerCheckBox (wxCommandEvent &event)
 Function OnLayerCheckBox handles the "is layer visible" checkbox and propogates the event to the client's notification function. More...
 
void OnRightDownRender (wxMouseEvent &aEvent, COLOR_SWATCH *aColorSwatch, const wxString &aRenderName)
 Function OnRightDownRender Called when user right-clicks a render option. More...
 
void OnRenderSwatchChanged (wxCommandEvent &aEvent)
 Function OnRenderSwatchChanged Called when user has changed the swatch color of a render entry. More...
 
void OnRenderCheckBox (wxCommandEvent &event)
 
void OnTabChange (wxNotebookEvent &event)
 
wxWindow * getLayerComp (int aRow, int aColumn) const
 Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL if these parameters are out of range. More...
 
wxWindow * getRenderComp (int aRow, int aColumn) const
 
int findLayerRow (LAYER_NUM aLayer) const
 Function findLayerRow returns the row index that aLayer resides in, or -1 if not found. More...
 
int findRenderRow (int aId) const
 
void insertLayerRow (int aRow, const ROW &aSpec)
 Function insertLayerRow appends or inserts a new row in the layer portion of the widget. More...
 
void insertRenderRow (int aRow, const ROW &aSpec)
 
void setLayerCheckbox (LAYER_NUM aLayer, bool isVisible)
 
void passOnFocus ()
 Function passOnFocus gives away the keyboard focus up to the main parent window. More...
 

Static Protected Member Functions

static int encodeId (int aColumn, int aId)
 Function encodeId is here to allow saving a layer index within a control as its wxControl id, but to do so in a way that all child wxControl ids within a wxWindow are unique, since this is required by Windows. More...
 
static LAYER_NUM getDecodedId (int aControlId)
 Function getDecodedId decodes aControlId to original un-encoded value. More...
 

Protected Attributes

wxAuiNotebook * m_notebook
 
wxPanel * m_LayerPanel
 
wxScrolledWindow * m_LayerScrolledWindow
 
wxFlexGridSizer * m_LayersFlexGridSizer
 
wxPanel * m_RenderingPanel
 
wxScrolledWindow * m_RenderScrolledWindow
 
wxFlexGridSizer * m_RenderFlexGridSizer
 
wxWindow * m_FocusOwner
 
int m_CurrentRow
 selected row of layer list More...
 
int m_PointSize
 
ROW_ICON_PROVIDERm_IconProvider
 

Detailed Description

Class LAYER_WIDGET is abstract and is used to manage a list of layers, with the notion of a "current" layer, and layer specific visibility control.

You must derive from it to use it so you can implement the abstract functions which recieve the events. Each layer is given its own color, and that color can be changed within the UI provided here. This widget knows nothing of the client code, meaning it has no knowledge of a BOARD or anything. To use it you must derive from this class and implement the abstract functions:

void OnLayerColorChange( int aLayer, int aColor );

bool OnLayerSelect( int aLayer );

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)

Definition at line 79 of file layer_widget.h.

Member Enumeration Documentation

enum LAYER_WIDGET::POPUP_ID
protected
Enumerator
ID_CHANGE_LAYER_COLOR 
ID_CHANGE_RENDER_COLOR 
ID_LAST_VALUE 

Definition at line 251 of file layer_widget.h.

Constructor & Destructor Documentation

LAYER_WIDGET::LAYER_WIDGET ( wxWindow *  aParent,
wxWindow *  aFocusOwner,
wxWindowID  id = wxID_ANY,
const wxPoint pos = wxDefaultPosition,
const wxSize &  size = wxDefaultSize,
long  style = wxTAB_TRAVERSAL 
)

Constructor.

Parameters
aParentis the parent window
aFocusOwneris the window that should be sent the focus after
idis the wxWindow id ( default = wxID_ANY)
posis the window position
sizeis the window size
styleis the window style every operation.

Definition at line 450 of file layer_widget.cpp.

References LYR_COLUMN_COUNT, m_CurrentRow, m_FocusOwner, m_IconProvider, m_LayerPanel, m_LayerScrolledWindow, m_LayersFlexGridSizer, m_notebook, m_PointSize, m_RenderFlexGridSizer, m_RenderingPanel, m_RenderScrolledWindow, OnTabChange(), and RND_COLUMN_COUNT.

Referenced by UpdateLayerIcons().

451  :
452  wxPanel( aParent, id, pos, size, style )
453 {
454  int indicatorSize = ConvertDialogToPixels( wxSize( 6, 6 ) ).x;
455  m_IconProvider = new ROW_ICON_PROVIDER( indicatorSize );
456 
457  int pointSize = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ).GetPointSize();
458  int screenHeight = wxSystemSettings::GetMetric( wxSYS_SCREEN_Y );
459 
460  if( screenHeight <= 900 && pointSize >= indicatorSize )
461  pointSize = pointSize * 8 / 10;
462 
463  m_PointSize = pointSize;
464 
465  wxBoxSizer* mainSizer = new wxBoxSizer( wxVERTICAL );
466 
467  m_notebook = new wxAuiNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxAUI_NB_TOP );
468 
469  wxFont font = m_notebook->GetFont();
470 
471  // change the font size on the notebook's tabs to match aPointSize
472  font.SetPointSize( pointSize );
473  m_notebook->SetFont( font );
474  m_notebook->SetNormalFont( font );
475  m_notebook->SetSelectedFont( font );
476  m_notebook->SetMeasuringFont( font );
477 
478  m_LayerPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
479 
480  wxBoxSizer* layerPanelSizer;
481  layerPanelSizer = new wxBoxSizer( wxVERTICAL );
482 
483  m_LayerScrolledWindow = new wxScrolledWindow( m_LayerPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER );
484  m_LayerScrolledWindow->SetScrollRate( 5, 5 );
485  m_LayersFlexGridSizer = new wxFlexGridSizer( 0, LYR_COLUMN_COUNT, 0, 1 );
486  m_LayersFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL );
487  m_LayersFlexGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
488 
490  m_LayerScrolledWindow->Layout();
492  layerPanelSizer->Add( m_LayerScrolledWindow, 1, wxBOTTOM|wxEXPAND|wxLEFT|wxTOP, 2 );
493 
494  m_LayerPanel->SetSizer( layerPanelSizer );
495  m_LayerPanel->Layout();
496  layerPanelSizer->Fit( m_LayerPanel );
497  m_notebook->AddPage( m_LayerPanel, _( "Layers" ), true );
498  m_RenderingPanel = new wxPanel( m_notebook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
499 
500  wxBoxSizer* renderPanelSizer;
501  renderPanelSizer = new wxBoxSizer( wxVERTICAL );
502 
503  m_RenderScrolledWindow = new wxScrolledWindow( m_RenderingPanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxNO_BORDER );
504  m_RenderScrolledWindow->SetScrollRate( 5, 5 );
505  m_RenderFlexGridSizer = new wxFlexGridSizer( 0, RND_COLUMN_COUNT, 0, 1 );
506  m_RenderFlexGridSizer->SetFlexibleDirection( wxHORIZONTAL );
507  m_RenderFlexGridSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_NONE );
508 
510  m_RenderScrolledWindow->Layout();
512  renderPanelSizer->Add( m_RenderScrolledWindow, 1, wxALL|wxEXPAND, 5 );
513 
514  m_RenderingPanel->SetSizer( renderPanelSizer );
515  m_RenderingPanel->Layout();
516  renderPanelSizer->Fit( m_RenderingPanel );
517  m_notebook->AddPage( m_RenderingPanel, _( "Items" ), false );
518 
519  mainSizer->Add( m_notebook, 1, wxEXPAND, 5 );
520 
521  SetSizer( mainSizer );
522 
523  m_FocusOwner = aFocusOwner;
524 
525  m_CurrentRow = -1; // hide the arrow initially
526 
527  // trap the tab changes so that we can call passOnFocus().
528  m_notebook->Bind( wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, &LAYER_WIDGET::OnTabChange, this );
529 
530  Layout();
531 }
wxAuiNotebook * m_notebook
Definition: layer_widget.h:123
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
int m_CurrentRow
selected row of layer list
Definition: layer_widget.h:132
Icon provider for the "standard" row indicators, for example in layer selection lists.
void OnTabChange(wxNotebookEvent &event)
wxScrolledWindow * m_RenderScrolledWindow
Definition: layer_widget.h:128
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:126
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:50
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:129
wxPanel * m_RenderingPanel
Definition: layer_widget.h:127
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:125
wxWindow * m_FocusOwner
Definition: layer_widget.h:131
ROW_ICON_PROVIDER * m_IconProvider
Definition: layer_widget.h:135
wxPanel * m_LayerPanel
Definition: layer_widget.h:124
LAYER_WIDGET::~LAYER_WIDGET ( )
virtual

Definition at line 534 of file layer_widget.cpp.

References m_IconProvider.

535 {
536  delete m_IconProvider;
537 }
ROW_ICON_PROVIDER * m_IconProvider
Definition: layer_widget.h:135

Member Function Documentation

void LAYER_WIDGET::AppendLayerRow ( const ROW aRow)

Function AppendLayerRow appends a new row in the layer portion of the widget.

The user must ensure that ROW::id is unique for all existing rows on Windows.

Definition at line 609 of file layer_widget.cpp.

References GetLayerRowCount(), and insertLayerRow().

Referenced by AppendLayerRows(), PCB_LAYER_WIDGET::ReFill(), and GERBER_LAYER_WIDGET::ReFill().

610 {
611  int nextRow = GetLayerRowCount();
612  insertLayerRow( nextRow, aRow );
613 }
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
void insertLayerRow(int aRow, const ROW &aSpec)
Function insertLayerRow appends or inserts a new row in the layer portion of the widget.
void LAYER_WIDGET::AppendLayerRows ( const ROW aRowsArray,
int  aRowCount 
)
inline

Function AppendLayerRows appends new rows in the layer portion of the widget.

The user must ensure that ROW::id is unique for all existing rows on Windows.

Definition at line 307 of file layer_widget.h.

References AppendLayerRow(), AppendRenderRow(), ClearLayerRows(), and UpdateLayouts().

308  {
309  for( int row=0; row<aRowCount; ++row )
310  AppendLayerRow( aRowsArray[row] );
311 
312  UpdateLayouts();
313  }
void UpdateLayouts()
void AppendLayerRow(const ROW &aRow)
Function AppendLayerRow appends a new row in the layer portion of the widget.
void LAYER_WIDGET::AppendRenderRow ( const ROW aRow)

Function AppendRenderRow appends a new row in the render portion of the widget.

The user must ensure that ROW::id is unique for all existing rows on Windows.

Definition at line 622 of file layer_widget.cpp.

References GetRenderRowCount(), and insertRenderRow().

Referenced by AppendLayerRows(), AppendRenderRows(), and PCB_LAYER_WIDGET::ReFillRender().

623 {
624  int nextRow = GetRenderRowCount();
625  insertRenderRow( nextRow, aRow );
626 }
void insertRenderRow(int aRow, const ROW &aSpec)
int GetRenderRowCount() const
Function GetRenderRowCount returns the number of rows in the render tab.
void LAYER_WIDGET::AppendRenderRows ( const ROW aRowsArray,
int  aRowCount 
)
inline

Function AppendRenderRows appends new rows in the render portion of the widget.

The user must ensure that ROW::id is unique for all existing rows on Windows.

Definition at line 333 of file layer_widget.h.

References AppendRenderRow(), ClearRenderRows(), GetLayerColor(), GetRenderState(), GetSelectedLayer(), IsLayerVisible(), OnLayerColorChange(), OnLayerRightClick(), OnLayerSelect(), OnLayerVisible(), OnRenderColorChange(), OnRenderEnable(), SelectLayer(), SelectLayerRow(), SetLayerColor(), SetLayerVisible(), SetRenderState(), UpdateLayerIcons(), and UpdateLayouts().

Referenced by GERBER_LAYER_WIDGET::ReFillRender().

334  {
335  for( int row=0; row<aRowCount; ++row )
336  AppendRenderRow( aRowsArray[row] );
337 
338  UpdateLayouts();
339  }
void UpdateLayouts()
void AppendRenderRow(const ROW &aRow)
Function AppendRenderRow appends a new row in the render portion of the widget.
virtual bool LAYER_WIDGET::AreArbitraryColorsAllowed ( )
inlineprotectedvirtual

Subclasses can override this to provide logic for allowing arbitrary color selection via wxColourPicker instead of DisplayColorFrame.

Reimplemented in PCB_LAYER_WIDGET, and GERBER_LAYER_WIDGET.

Definition at line 152 of file layer_widget.h.

Referenced by insertLayerRow(), and insertRenderRow().

152 { return false; }
void LAYER_WIDGET::ClearLayerRows ( )

Function ClearLayerRows empties out the layer rows.

Definition at line 616 of file layer_widget.cpp.

References m_LayersFlexGridSizer.

Referenced by AppendLayerRows(), PCB_LAYER_WIDGET::ReFill(), and GERBER_LAYER_WIDGET::ReFill().

617 {
618  m_LayersFlexGridSizer->Clear( true );
619 }
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:126
void LAYER_WIDGET::ClearRenderRows ( )

Function ClearRenderRows empties out the render rows.

Definition at line 629 of file layer_widget.cpp.

References m_RenderFlexGridSizer.

Referenced by AppendRenderRows(), PCB_LAYER_WIDGET::ReFillRender(), and GERBER_LAYER_WIDGET::ReFillRender().

630 {
631  m_RenderFlexGridSizer->Clear( true );
632 }
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:129
int LAYER_WIDGET::encodeId ( int  aColumn,
int  aId 
)
staticprotected

Function encodeId is here to allow saving a layer index within a control as its wxControl id, but to do so in a way that all child wxControl ids within a wxWindow are unique, since this is required by Windows.

See also
getDecodedId()

Definition at line 63 of file layer_widget.cpp.

References LYR_COLUMN_COUNT.

Referenced by getBackgroundLayerColor(), insertLayerRow(), and insertRenderRow().

64 {
65  int id = aId * LYR_COLUMN_COUNT + aColumn;
66  return id;
67 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
int LAYER_WIDGET::findLayerRow ( LAYER_NUM  aLayer) const
protected

Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.

Definition at line 265 of file layer_widget.cpp.

References getDecodedId(), getLayerComp(), and GetLayerRowCount().

Referenced by getBackgroundLayerColor(), GetLayerColor(), IsLayerVisible(), OnLeftDownLayers(), SelectLayer(), setLayerCheckbox(), and SetLayerColor().

266 {
267  int count = GetLayerRowCount();
268 
269  for( int row = 0; row < count; ++row )
270  {
271  // column 0 in the layer scroll window has a wxStaticBitmap, get its ID.
272  wxWindow* w = getLayerComp( row, 0 );
273  wxASSERT( w );
274 
275  if( aLayer == getDecodedId( w->GetId() ))
276  return row;
277  }
278 
279  return -1;
280 }
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_WIDGET::findRenderRow ( int  aId) const
protected

Definition at line 294 of file layer_widget.cpp.

References getDecodedId(), getRenderComp(), and GetRenderRowCount().

Referenced by getBackgroundLayerColor(), GetRenderState(), and SetRenderState().

295 {
296  int count = GetRenderRowCount();
297 
298  for( int row = 0; row < count; ++row )
299  {
300  // column 0 in the layer scroll window has a wxStaticBitmap, get its ID.
301  wxWindow* w = getRenderComp( row, 0 );
302  wxASSERT( w );
303 
304  if( aId == getDecodedId( w->GetId() ))
305  return row;
306  }
307 
308  return -1;
309 }
int GetRenderRowCount() const
Function GetRenderRowCount returns the number of rows in the render tab.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
wxWindow * getRenderComp(int aRow, int aColumn) const
virtual COLOR4D LAYER_WIDGET::getBackgroundLayerColor ( )
inlineprotectedvirtual
wxSize LAYER_WIDGET::GetBestSize ( ) const

Function GetBestSize returns the preferred minimum size, taking into consideration the dynamic content.

Nothing in wxWidgets was reliable enough so this overrides one of their functions.

Definition at line 540 of file layer_widget.cpp.

References i, LYR_COLUMN_COUNT, m_LayerPanel, m_LayersFlexGridSizer, m_RenderFlexGridSizer, m_RenderingPanel, max, and RND_COLUMN_COUNT.

Referenced by GERBVIEW_FRAME::GERBVIEW_FRAME(), GERBVIEW_FRAME::ReFillLayerWidget(), and FOOTPRINT_EDIT_FRAME::ReFillLayerWidget().

541 {
542  // size of m_LayerScrolledWindow --------------
543  wxArrayInt widths = m_LayersFlexGridSizer->GetColWidths();
544  int totWidth = 0;
545 
546  if( widths.GetCount() )
547  {
548  for( int i = 0; i < LYR_COLUMN_COUNT; ++i )
549  {
550  totWidth += widths[i] + m_LayersFlexGridSizer->GetHGap();
551  // printf("widths[%d]:%d\n", i, widths[i] );
552  }
553  }
554 
555  // Account for the parent's frame:
556  totWidth += 15;
557 
558 
559  /* The minimum height is a small size to properly force computation
560  * of the panel's scrollbars (otherwise it will assume it *has* all
561  * this space) */
562  unsigned totHeight = 32;
563 
564  wxSize layerz( totWidth, totHeight );
565 
566  layerz += m_LayerPanel->GetWindowBorderSize();
567 
568 
569  // size of m_RenderScrolledWindow --------------
570  widths = m_RenderFlexGridSizer->GetColWidths();
571  totWidth = 0;
572 
573  if( widths.GetCount() )
574  {
575  for( int i = 0; i < RND_COLUMN_COUNT; ++i )
576  {
577  totWidth += widths[i] + m_RenderFlexGridSizer->GetHGap();
578  // printf("widths[%d]:%d\n", i, widths[i] );
579  }
580  }
581  // account for the parent's frame, this one has void space of 10 PLUS a border:
582  totWidth += 15;
583 
584  // For totHeight re-use the previous small one
585  wxSize renderz( totWidth, totHeight );
586 
587  renderz += m_RenderingPanel->GetWindowBorderSize();
588 
589  wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) );
590 
591  return clientz;
592 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:126
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:50
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:129
wxPanel * m_RenderingPanel
Definition: layer_widget.h:127
#define max(a, b)
Definition: auxiliary.h:86
size_t i
Definition: json11.cpp:597
wxPanel * m_LayerPanel
Definition: layer_widget.h:124
LAYER_NUM LAYER_WIDGET::getDecodedId ( int  aControlId)
staticprotected

Function getDecodedId decodes 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)

Definition at line 70 of file layer_widget.cpp.

References LYR_COLUMN_COUNT.

Referenced by findLayerRow(), findRenderRow(), getBackgroundLayerColor(), GetSelectedLayer(), OnLayerCheckBox(), OnLayerSwatchChanged(), OnLeftDownLayers(), GERBER_LAYER_WIDGET::onPopupSelection(), PCB_LAYER_WIDGET::onPopupSelection(), OnRenderCheckBox(), OnRenderSwatchChanged(), PCB_LAYER_WIDGET::SyncLayerAlphaIndicators(), and PCB_LAYER_WIDGET::SyncLayerVisibilities().

71 {
72  int id = aControlId / LYR_COLUMN_COUNT; // rounding is OK.
73  return id;
74 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
COLOR4D LAYER_WIDGET::GetLayerColor ( LAYER_NUM  aLayer) const

Function GetLayerColor returns the color of the layer ROW associated with aLayer id.

Definition at line 732 of file layer_widget.cpp.

References findLayerRow(), and getLayerComp().

Referenced by AppendRenderRows().

733 {
734  int row = findLayerRow( aLayer );
735  if( row >= 0 )
736  {
737  int col = 1; // bitmap button is column 1
738  auto swatch = static_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
739  wxASSERT( swatch );
740 
741  return swatch->GetSwatchColor();
742  }
743 
744  return COLOR4D::UNSPECIFIED; // it's caller fault, gave me a bad layer
745 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
wxWindow * LAYER_WIDGET::getLayerComp ( int  aRow,
int  aColumn 
) const
protected

Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL if these parameters are out of range.

Parameters
aRowis the row index
aColumnis the column
Returns
wxWindow - the component installed within the sizer at given grid coordinate.

Definition at line 254 of file layer_widget.cpp.

References LYR_COLUMN_COUNT, and m_LayersFlexGridSizer.

Referenced by findLayerRow(), getBackgroundLayerColor(), GetLayerColor(), GetSelectedLayer(), IsLayerVisible(), OnLeftDownLayers(), GERBER_LAYER_WIDGET::onPopupSelection(), PCB_LAYER_WIDGET::onPopupSelection(), OnRenderSwatchChanged(), PCB_LAYER_WIDGET::ReFill(), SelectLayerRow(), setLayerCheckbox(), SetLayerColor(), PCB_LAYER_WIDGET::SyncLayerAlphaIndicators(), PCB_LAYER_WIDGET::SyncLayerVisibilities(), and UpdateLayerIcons().

255 {
256  unsigned ndx = aRow * LYR_COLUMN_COUNT + aColumn;
257 
258  if( ndx < m_LayersFlexGridSizer->GetChildren().GetCount() )
259  return m_LayersFlexGridSizer->GetChildren()[ndx]->GetWindow();
260 
261  return NULL;
262 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:126
int LAYER_WIDGET::GetLayerRowCount ( ) const

Function GetLayerRowCount returns the number of rows in the layer tab.

Definition at line 595 of file layer_widget.cpp.

References LYR_COLUMN_COUNT, and m_LayersFlexGridSizer.

Referenced by AppendLayerRow(), findLayerRow(), OnLeftDownLayers(), GERBER_LAYER_WIDGET::onPopupSelection(), PCB_LAYER_WIDGET::onPopupSelection(), OnRenderSwatchChanged(), PCB_LAYER_WIDGET::ReFill(), PCB_LAYER_WIDGET::SyncLayerAlphaIndicators(), PCB_LAYER_WIDGET::SyncLayerVisibilities(), and UpdateLayerIcons().

596 {
597  int controlCount = m_LayersFlexGridSizer->GetChildren().GetCount();
598  return controlCount / LYR_COLUMN_COUNT;
599 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:126
wxWindow * LAYER_WIDGET::getRenderComp ( int  aRow,
int  aColumn 
) const
protected

Definition at line 283 of file layer_widget.cpp.

References m_RenderFlexGridSizer, and RND_COLUMN_COUNT.

Referenced by findRenderRow(), getBackgroundLayerColor(), GetRenderState(), OnRenderSwatchChanged(), and SetRenderState().

284 {
285  int ndx = aRow * RND_COLUMN_COUNT + aColumn;
286 
287  if( (unsigned) ndx < m_RenderFlexGridSizer->GetChildren().GetCount() )
288  return m_RenderFlexGridSizer->GetChildren()[ndx]->GetWindow();
289 
290  return NULL;
291 }
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:50
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:129
int LAYER_WIDGET::GetRenderRowCount ( ) const

Function GetRenderRowCount returns the number of rows in the render tab.

Definition at line 602 of file layer_widget.cpp.

References m_RenderFlexGridSizer, and RND_COLUMN_COUNT.

Referenced by AppendRenderRow(), findRenderRow(), and OnRenderSwatchChanged().

603 {
604  int controlCount = m_RenderFlexGridSizer->GetChildren().GetCount();
605  return controlCount / RND_COLUMN_COUNT;
606 }
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:50
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:129
bool LAYER_WIDGET::GetRenderState ( int  aId)

Function GetRenderState returns the state of the checkbox associated with aId.

Returns
bool - true if checked, else false.

Definition at line 762 of file layer_widget.cpp.

References findRenderRow(), and getRenderComp().

Referenced by AppendRenderRows().

763 {
764  int row = findRenderRow( aId );
765 
766  if( row >= 0 )
767  {
768  int col = 1; // checkbox is column 1
769  wxCheckBox* cb = (wxCheckBox*) getRenderComp( row, col );
770  wxASSERT( cb );
771  return cb->GetValue();
772  }
773 
774  return false; // the value of a non-existent row
775 }
int findRenderRow(int aId) const
wxWindow * getRenderComp(int aRow, int aColumn) const
LAYER_NUM LAYER_WIDGET::GetSelectedLayer ( )

Function GetSelectedLayer returns the selected layer or -1 if none.

Definition at line 676 of file layer_widget.cpp.

References getDecodedId(), getLayerComp(), m_CurrentRow, and UNDEFINED_LAYER.

Referenced by AppendRenderRows().

677 {
678  wxWindow* w = getLayerComp( m_CurrentRow, 0 );
679  if( w )
680  return getDecodedId( w->GetId() );
681 
682  return UNDEFINED_LAYER;
683 }
int m_CurrentRow
selected row of layer list
Definition: layer_widget.h:132
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
void LAYER_WIDGET::insertLayerRow ( int  aRow,
const ROW aSpec 
)
protected

Function insertLayerRow appends or inserts a new row in the layer portion of the widget.

Definition at line 312 of file layer_widget.cpp.

References AreArbitraryColorsAllowed(), LAYER_WIDGET::ROW::color, COLUMN_ALPHA_INDICATOR, COLUMN_COLOR_LYR_CB, COLUMN_COLOR_LYRNAME, COLUMN_COLORBM, COLUMN_ICON_ACTIVE, encodeId(), getBackgroundLayerColor(), LAYER_WIDGET::ROW::id, LYR_COLUMN_COUNT, m_IconProvider, m_LayerScrolledWindow, m_LayersFlexGridSizer, m_PointSize, OFF, OnLayerCheckBox(), OnLayerSwatchChanged(), OnLeftDownLayers(), OnRightDownLayer(), LAYER_WIDGET::ROW::rowName, shrinkFont(), LAYER_WIDGET::ROW::state, and LAYER_WIDGET::ROW::tooltip.

Referenced by AppendLayerRow(), and getBackgroundLayerColor().

313 {
314  wxASSERT( aRow >= 0 );
315 
316  int col;
317  int index = aRow * LYR_COLUMN_COUNT;
318  const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
319 
320  // column 0
321  col = COLUMN_ICON_ACTIVE;
323  ROW_ICON_PROVIDER::STATE::OFF, encodeId( col, aSpec.id ) );
324  sbm->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this );
325  m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags );
326 
327  // column 1 (COLUMN_COLORBM)
328  col = COLUMN_COLORBM;
329 
330  auto bmb = new COLOR_SWATCH( m_LayerScrolledWindow, aSpec.color, encodeId( col, aSpec.id ),
332  bmb->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this );
333  bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnLayerSwatchChanged, this );
334  bmb->SetToolTip( _("Left double click or middle click for color change, right click for menu" ) );
335  m_LayersFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags );
336 
337  // column 2 (COLUMN_COLOR_LYR_CB)
338  col = COLUMN_COLOR_LYR_CB;
339  wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, encodeId( col, aSpec.id ), wxEmptyString );
340  cb->SetValue( aSpec.state );
341  cb->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LAYER_WIDGET::OnLayerCheckBox, this );
342  cb->SetToolTip( _( "Enable this for visibility" ) );
343  m_LayersFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags );
344 
345  // column 3 (COLUMN_COLOR_LYRNAME)
346  col = COLUMN_COLOR_LYRNAME;
347  wxStaticText* st = new wxStaticText( m_LayerScrolledWindow, encodeId( col, aSpec.id ), aSpec.rowName );
348  shrinkFont( st, m_PointSize );
349  st->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this );
350  st->SetToolTip( aSpec.tooltip );
351  m_LayersFlexGridSizer->wxSizer::Insert( index+col, st, 0, flags );
352 
353  // column 4 (COLUMN_ALPHA_INDICATOR)
356  ROW_ICON_PROVIDER::STATE::OFF, wxID_ANY );
357  m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags );
358 
359  // Bind right click eventhandler to all columns
360  wxString layerName( aSpec.rowName );
361 
362  sbm->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
363  OnRightDownLayer( aEvt, bmb, layerName );
364  } );
365  bmb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
366  OnRightDownLayer( aEvt, bmb, layerName );
367  } );
368  cb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
369  OnRightDownLayer( aEvt, bmb, layerName );
370  } );
371  st->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
372  OnRightDownLayer( aEvt, bmb, layerName );
373  } );
374 }
#define COLUMN_COLOR_LYRNAME
Definition: layer_widget.h:55
void OnLeftDownLayers(wxMouseEvent &event)
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:49
#define COLUMN_ALPHA_INDICATOR
Definition: layer_widget.h:56
#define OFF
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:126
static void shrinkFont(wxWindow *aControl, int aPointSize)
Function shrinkFont reduces the size of the wxFont associated with aControl.
void OnLayerCheckBox(wxCommandEvent &event)
Function OnLayerCheckBox handles the "is layer visible" checkbox and propogates the event to the clie...
static int encodeId(int aColumn, int aId)
Function encodeId is here to allow saving a layer index within a control as its wxControl id...
Class representing a row indicator icon for use in places like the layer widget.
#define COLUMN_ICON_ACTIVE
Definition: layer_widget.h:52
#define COLUMN_COLORBM
Definition: layer_widget.h:53
virtual bool AreArbitraryColorsAllowed()
Subclasses can override this to provide logic for allowing arbitrary color selection via wxColourPick...
Definition: layer_widget.h:152
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:125
void OnRightDownLayer(wxMouseEvent &event, COLOR_SWATCH *aColorSwatch, const wxString &aLayerName)
Function OnRightDownLayer Called when user right-clicks a layer.
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:54
virtual COLOR4D getBackgroundLayerColor()
Subclasses can override this to provide accurate representation of transparent colour swatches...
Definition: layer_widget.h:158
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
void OnLayerSwatchChanged(wxCommandEvent &aEvent)
Function OnSwatchChanged() is called when a user changes a swatch color.
ROW_ICON_PROVIDER * m_IconProvider
Definition: layer_widget.h:135
void LAYER_WIDGET::insertRenderRow ( int  aRow,
const ROW aSpec 
)
protected

Definition at line 377 of file layer_widget.cpp.

References AreArbitraryColorsAllowed(), LAYER_WIDGET::ROW::changeable, LAYER_WIDGET::ROW::color, encodeId(), getBackgroundLayerColor(), LAYER_WIDGET::ROW::id, m_PointSize, m_RenderFlexGridSizer, m_RenderScrolledWindow, OnRenderCheckBox(), OnRenderSwatchChanged(), OnRightDownRender(), RND_COLUMN_COUNT, LAYER_WIDGET::ROW::rowName, shrinkFont(), LAYER_WIDGET::ROW::spacer, LAYER_WIDGET::ROW::state, and LAYER_WIDGET::ROW::tooltip.

Referenced by AppendRenderRow(), and getBackgroundLayerColor().

378 {
379  wxASSERT( aRow >= 0 );
380 
381  int col;
382  int index = aRow * RND_COLUMN_COUNT;
383  const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
384 
385  wxString renderName( aSpec.rowName );
386  wxCheckBox* cb = nullptr;
387 
388  // column 1
389  if( !aSpec.spacer )
390  {
391  col = 1;
392  cb = new wxCheckBox( m_RenderScrolledWindow, encodeId( col, aSpec.id ),
393  aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
394  shrinkFont( cb, m_PointSize );
395  cb->SetValue( aSpec.state );
396  cb->Enable( aSpec.changeable );
397  cb->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LAYER_WIDGET::OnRenderCheckBox, this );
398  cb->SetToolTip( aSpec.tooltip );
399  }
400 
401  // column 0
402  col = 0;
403  if( aSpec.color != COLOR4D::UNSPECIFIED )
404  {
405  auto bmb = new COLOR_SWATCH( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ),
407  bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnRenderSwatchChanged, this );
408  bmb->SetToolTip( _( "Left double click or middle click for color change" ) );
409  m_RenderFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags );
410 
411  bmb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, renderName] ( wxMouseEvent& aEvt ) {
412  OnRightDownRender( aEvt, bmb, renderName );
413  } );
414  cb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, renderName] ( wxMouseEvent& aEvt ) {
415  OnRightDownRender( aEvt, bmb, renderName );
416  } );
417 
418  // could add a left click handler on the color button that toggles checkbox.
419  }
420  else // == -1, no color selection wanted
421  {
422  // need a place holder within the sizer to keep grid full.
423  wxPanel* invisible = new wxPanel( m_RenderScrolledWindow, encodeId( col, aSpec.id ) );
424  m_RenderFlexGridSizer->wxSizer::Insert( index+col, invisible, 0, flags );
425  }
426 
427  // Items have to be inserted in order
428  col = 1;
429 
430  if( aSpec.spacer )
431  {
432  wxPanel* invisible = new wxPanel( m_RenderScrolledWindow, wxID_ANY );
433  m_RenderFlexGridSizer->wxSizer::Insert( index+col, invisible, 0, flags );
434  }
435  else
436  {
437  m_RenderFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags );
438  }
439 }
wxScrolledWindow * m_RenderScrolledWindow
Definition: layer_widget.h:128
static void shrinkFont(wxWindow *aControl, int aPointSize)
Function shrinkFont reduces the size of the wxFont associated with aControl.
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:50
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:129
void OnRenderCheckBox(wxCommandEvent &event)
static int encodeId(int aColumn, int aId)
Function encodeId is here to allow saving a layer index within a control as its wxControl id...
void OnRightDownRender(wxMouseEvent &aEvent, COLOR_SWATCH *aColorSwatch, const wxString &aRenderName)
Function OnRightDownRender Called when user right-clicks a render option.
virtual bool AreArbitraryColorsAllowed()
Subclasses can override this to provide logic for allowing arbitrary color selection via wxColourPick...
Definition: layer_widget.h:152
void OnRenderSwatchChanged(wxCommandEvent &aEvent)
Function OnRenderSwatchChanged Called when user has changed the swatch color of a render entry...
virtual COLOR4D getBackgroundLayerColor()
Subclasses can override this to provide accurate representation of transparent colour swatches...
Definition: layer_widget.h:158
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
bool LAYER_WIDGET::IsLayerVisible ( LAYER_NUM  aLayer)

Function IsLayerVisible returns the visible state of the layer ROW associated with aLayer id.

Definition at line 705 of file layer_widget.cpp.

References COLUMN_COLOR_LYR_CB, findLayerRow(), and getLayerComp().

Referenced by AppendRenderRows(), and GERBVIEW_FRAME::IsLayerVisible().

706 {
707  int row = findLayerRow( aLayer );
708  if( row >= 0 )
709  {
710  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
711  wxASSERT( cb );
712  return cb->GetValue();
713  }
714  return false;
715 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:54
void LAYER_WIDGET::OnLayerCheckBox ( wxCommandEvent &  event)
protected

Function OnLayerCheckBox handles the "is layer visible" checkbox and propogates the event to the client's notification function.

Definition at line 168 of file layer_widget.cpp.

References getDecodedId(), OnLayerVisible(), and passOnFocus().

Referenced by getBackgroundLayerColor(), and insertLayerRow().

169 {
170  wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
171  LAYER_NUM layer = getDecodedId( eventSource->GetId() );
172  OnLayerVisible( layer, eventSource->IsChecked() );
173  passOnFocus();
174 }
virtual void OnLayerVisible(LAYER_NUM aLayer, bool isVisible, bool isFinal=true)=0
Function OnLayerVisible is called to notify client code about a layer visibility change.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
virtual void LAYER_WIDGET::OnLayerColorChange ( int  aLayer,
COLOR4D  aColor 
)
pure virtual

Function OnLayerColorChange is called to notify client code about a layer color change.

Derived classes will handle this accordingly.

Parameters
aLayeris the board layer to change
aColoris the new color

Implemented in GERBER_LAYER_WIDGET, and PCB_LAYER_WIDGET.

Referenced by AppendRenderRows(), OnLayerSwatchChanged(), and UpdateLayerIcons().

virtual void LAYER_WIDGET::OnLayerRightClick ( wxMenu &  aMenu)
pure virtual

Function OnLayerRightClick is called to notify client code about a layer being right-clicked.

Parameters
aMenuis the right-click menu containing layer-scoped options. It can be used to add extra, wider scoped menu items.

Implemented in PCB_LAYER_WIDGET, and GERBER_LAYER_WIDGET.

Referenced by AppendRenderRows(), and OnRightDownLayer().

virtual bool LAYER_WIDGET::OnLayerSelect ( int  aLayer)
pure virtual

Function OnLayerSelect is called to notify client code whenever the user selects a different layer.

Derived classes will handle this accordingly, and can deny the change by returning false.

Parameters
aLayeris the board layer to select

Implemented in GERBER_LAYER_WIDGET, and PCB_LAYER_WIDGET.

Referenced by AppendRenderRows(), OnLeftDownLayers(), and UpdateLayerIcons().

void LAYER_WIDGET::OnLayerSwatchChanged ( wxCommandEvent &  aEvent)
protected

Function OnSwatchChanged() is called when a user changes a swatch color.

Definition at line 149 of file layer_widget.cpp.

References EVT_LAYER_COLOR_CHANGE, getDecodedId(), OnLayerColorChange(), and passOnFocus().

Referenced by getBackgroundLayerColor(), and insertLayerRow().

150 {
151  auto eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
152 
153  COLOR4D newColor = eventSource->GetSwatchColor();
154 
155  LAYER_NUM layer = getDecodedId( eventSource->GetId() );
156 
157  // tell the client code.
158  OnLayerColorChange( layer, newColor );
159 
160  // notify others
161  wxCommandEvent event( EVT_LAYER_COLOR_CHANGE );
162  wxPostEvent( this, event );
163 
164  passOnFocus();
165 }
static const wxEventType EVT_LAYER_COLOR_CHANGE
Definition: layer_widget.h:119
virtual void OnLayerColorChange(int aLayer, COLOR4D aColor)=0
Function OnLayerColorChange is called to notify client code about a layer color change.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
virtual void LAYER_WIDGET::OnLayerVisible ( LAYER_NUM  aLayer,
bool  isVisible,
bool  isFinal = true 
)
pure virtual

Function OnLayerVisible is called to notify client code about a layer visibility change.

Parameters
aLayeris the board layer to select
isVisibleis the new visible state
isFinalis true when this is the last of potentially several such calls, and can be used to decide when to update the screen only one time instead of several times in the midst of a multiple layer change.

Implemented in GERBER_LAYER_WIDGET, and PCB_LAYER_WIDGET.

Referenced by AppendRenderRows(), OnLayerCheckBox(), SetLayerVisible(), and UpdateLayerIcons().

void LAYER_WIDGET::OnLeftDownLayers ( wxMouseEvent &  event)
protected

Definition at line 77 of file layer_widget.cpp.

References findLayerRow(), getDecodedId(), getLayerComp(), GetLayerRowCount(), m_LayerScrolledWindow, m_LayersFlexGridSizer, OnLayerSelect(), passOnFocus(), and SelectLayerRow().

Referenced by getBackgroundLayerColor(), and insertLayerRow().

78 {
79  int row;
80  LAYER_NUM layer;
81 
82  wxWindow* eventSource = (wxWindow*) event.GetEventObject();
83 
84  // if mouse event is coming from the m_LayerScrolledWindow and not one
85  // of its children, we have to find the row manually based on y coord.
86  if( eventSource == m_LayerScrolledWindow )
87  {
88  int y = event.GetY();
89 
90  wxArrayInt heights = m_LayersFlexGridSizer->GetRowHeights();
91 
92  int height = 0;
93 
94  int rowCount = GetLayerRowCount();
95  for( row = 0; row<rowCount; ++row )
96  {
97  if( y < height + heights[row] )
98  break;
99 
100  height += heights[row];
101  }
102 
103  if( row >= rowCount )
104  row = rowCount - 1;
105 
106  layer = getDecodedId( getLayerComp( row, 0 )->GetId() );
107  }
108 
109  else
110  {
111  // all nested controls on a given row will have their ID encoded with
112  // encodeId(), and the corresponding decoding is getDecodedId()
113  int id = eventSource->GetId();
114  layer = getDecodedId( id );
115  row = findLayerRow( layer );
116  }
117 
118  if( OnLayerSelect( layer ) ) // if client allows this change.
119  SelectLayerRow( row );
120 
121  passOnFocus();
122 }
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:126
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:125
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
void SelectLayerRow(int aRow)
Function SelectLayerRow changes the row selection in the layer list to the given row.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
virtual bool OnLayerSelect(int aLayer)=0
Function OnLayerSelect is called to notify client code whenever the user selects a different layer...
void LAYER_WIDGET::OnRenderCheckBox ( wxCommandEvent &  event)
protected

Definition at line 236 of file layer_widget.cpp.

References getDecodedId(), OnRenderEnable(), and passOnFocus().

Referenced by getBackgroundLayerColor(), and insertRenderRow().

237 {
238  wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
239  LAYER_NUM id = getDecodedId( eventSource->GetId() );
240  OnRenderEnable( id, eventSource->IsChecked() );
241  passOnFocus();
242 }
virtual void OnRenderEnable(int aId, bool isEnabled)=0
Function OnRenderEnable is called to notify client code whenever the user changes an rendering enable...
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
virtual void LAYER_WIDGET::OnRenderColorChange ( int  aId,
COLOR4D  aColor 
)
pure virtual

Function OnRenderColorChange is called to notify client code whenever the user changes a rendering color.

Parameters
aIdis the same id that was established in a Rendering row via the AddRenderRow() function.
aColoris the new color

Implemented in GERBER_LAYER_WIDGET, and PCB_LAYER_WIDGET.

Referenced by AppendRenderRows(), OnRenderSwatchChanged(), and UpdateLayerIcons().

virtual void LAYER_WIDGET::OnRenderEnable ( int  aId,
bool  isEnabled 
)
pure virtual

Function OnRenderEnable is called to notify client code whenever the user changes an rendering enable in one of the rendering checkboxes.

Parameters
aIdis the same id that was established in a Rendering row via the AddRenderRow() function.
isEnabledis the state of the checkbox, true if checked.

Implemented in GERBER_LAYER_WIDGET, and PCB_LAYER_WIDGET.

Referenced by AppendRenderRows(), OnRenderCheckBox(), and UpdateLayerIcons().

void LAYER_WIDGET::OnRenderSwatchChanged ( wxCommandEvent &  aEvent)
protected

Function OnRenderSwatchChanged Called when user has changed the swatch color of a render entry.

Definition at line 198 of file layer_widget.cpp.

References getDecodedId(), getLayerComp(), GetLayerRowCount(), getRenderComp(), GetRenderRowCount(), LAYER_PCB_BACKGROUND, OnRenderColorChange(), passOnFocus(), and COLOR_SWATCH::SetSwatchBackground().

Referenced by getBackgroundLayerColor(), and insertRenderRow().

199 {
200  auto eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
201 
202  COLOR4D newColor = eventSource->GetSwatchColor();
203 
204  LAYER_NUM id = getDecodedId( eventSource->GetId() );
205 
206  if( id == LAYER_PCB_BACKGROUND )
207  {
208  // Update all swatch backgrounds
209  int count = GetLayerRowCount();
210  int row;
211  int col = 1; // bitmap button is column 1 in layers tab
212  for( row = 0; row < count; ++row )
213  {
214  COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
215  if( swatch )
216  swatch->SetSwatchBackground( newColor );
217  }
218 
219  count = GetRenderRowCount();
220  col = 0; // bitmap button is column 0 in render tab
221  for( row = 0; row < count; ++row )
222  {
223  COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getRenderComp( row, col ) );
224  if( swatch )
225  swatch->SetSwatchBackground( newColor );
226  }
227  }
228 
229  // tell the client code.
230  OnRenderColorChange( id, newColor );
231 
232  passOnFocus();
233 }
virtual void OnRenderColorChange(int aId, COLOR4D aColor)=0
Function OnRenderColorChange is called to notify client code whenever the user changes a rendering co...
void SetSwatchBackground(KIGFX::COLOR4D aBackground)
Set the swatch background color.
int GetRenderRowCount() const
Function GetRenderRowCount returns the number of rows in the render tab.
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
static LAYER_NUM getDecodedId(int aControlId)
Function getDecodedId decodes aControlId to original un-encoded value.
int LAYER_NUM
Type LAYER_NUM can be replaced with int and removed.
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
Class COLOR4D is the color representation with 4 components: red, green, blue, alpha.
Definition: color4d.h:39
wxWindow * getRenderComp(int aRow, int aColumn) const
void LAYER_WIDGET::OnRightDownLayer ( wxMouseEvent &  event,
COLOR_SWATCH aColorSwatch,
const wxString &  aLayerName 
)
protected

Function OnRightDownLayer Called when user right-clicks a layer.

Definition at line 125 of file layer_widget.cpp.

References AddMenuItem(), COLOR_SWATCH::GetNewSwatchColor(), ID_CHANGE_LAYER_COLOR, KiBitmap(), OnLayerRightClick(), and passOnFocus().

Referenced by getBackgroundLayerColor(), and insertLayerRow().

126 {
127  wxMenu menu;
128 
130  _( "Change Layer Color for " ) + aLayerName,
131  KiBitmap( setcolor_copper_xpm ) );
132  menu.AppendSeparator();
133 
134  OnLayerRightClick( menu );
135 
136  menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event ) {
137  if ( event.GetId() == ID_CHANGE_LAYER_COLOR ) {
138  aColorSwatch->GetNewSwatchColor();
139  } else {
140  event.Skip();
141  }
142  } );
143 
144  PopupMenu( &menu );
145  passOnFocus();
146 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
virtual void OnLayerRightClick(wxMenu &aMenu)=0
Function OnLayerRightClick is called to notify client code about a layer being right-clicked.
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.
void LAYER_WIDGET::OnRightDownRender ( wxMouseEvent &  aEvent,
COLOR_SWATCH aColorSwatch,
const wxString &  aRenderName 
)
protected

Function OnRightDownRender Called when user right-clicks a render option.

Definition at line 177 of file layer_widget.cpp.

References AddMenuItem(), COLOR_SWATCH::GetNewSwatchColor(), ID_CHANGE_RENDER_COLOR, KiBitmap(), and passOnFocus().

Referenced by getBackgroundLayerColor(), and insertRenderRow().

178 {
179  wxMenu menu;
180 
182  _( "Change Render Color for " ) + aRenderName,
183  KiBitmap( setcolor_board_body_xpm ) );
184 
185  menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [aColorSwatch]( wxCommandEvent& event ) {
186  if ( event.GetId() == ID_CHANGE_RENDER_COLOR ) {
187  aColorSwatch->GetNewSwatchColor();
188  } else {
189  event.Skip();
190  }
191  } );
192 
193  PopupMenu( &menu );
194  passOnFocus();
195 }
wxMenuItem * AddMenuItem(wxMenu *aMenu, int aId, const wxString &aText, const wxBitmap &aImage, wxItemKind aType=wxITEM_NORMAL)
Function AddMenuItem is an inline helper function to create and insert a menu item with an icon into ...
Definition: bitmap.cpp:223
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
void GetNewSwatchColor()
Prompt for a new colour, using the colour picker dialog.
void LAYER_WIDGET::OnTabChange ( wxNotebookEvent &  event)
protected

Definition at line 245 of file layer_widget.cpp.

References passOnFocus().

Referenced by getBackgroundLayerColor(), and LAYER_WIDGET().

246 {
247 // wxFocusEvent event( wxEVT_SET_FOCUS );
248 // m_FocusOwner->AddPendingEvent( event );
249 
250  passOnFocus(); // does not work in this context, probably because we have receive control here too early.
251 }
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
void LAYER_WIDGET::passOnFocus ( )
protected

Function passOnFocus gives away the keyboard focus up to the main parent window.

Definition at line 442 of file layer_widget.cpp.

References m_FocusOwner.

Referenced by getBackgroundLayerColor(), OnLayerCheckBox(), OnLayerSwatchChanged(), OnLeftDownLayers(), OnRenderCheckBox(), OnRenderSwatchChanged(), OnRightDownLayer(), GERBER_LAYER_WIDGET::onRightDownLayers(), PCB_LAYER_WIDGET::onRightDownLayers(), OnRightDownRender(), OnTabChange(), and SelectLayerRow().

443 {
444  m_FocusOwner->SetFocus();
445 }
wxWindow * m_FocusOwner
Definition: layer_widget.h:131
void LAYER_WIDGET::SelectLayer ( LAYER_NUM  aLayer)

Function SelectLayer changes the row selection in the layer list to aLayer provided.

Definition at line 669 of file layer_widget.cpp.

References findLayerRow(), and SelectLayerRow().

Referenced by AppendRenderRows(), GERBVIEW_FRAME::SetActiveLayer(), GERBVIEW_FRAME::syncLayerWidget(), and FOOTPRINT_EDIT_FRAME::UpdateUserInterface().

670 {
671  int row = findLayerRow( aLayer );
672  SelectLayerRow( row );
673 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
void SelectLayerRow(int aRow)
Function SelectLayerRow changes the row selection in the layer list to the given row.
void LAYER_WIDGET::SelectLayerRow ( int  aRow)

Function SelectLayerRow changes the row selection in the layer list to the given row.

Definition at line 635 of file layer_widget.cpp.

References getLayerComp(), m_CurrentRow, m_notebook, OFF, ON, passOnFocus(), INDICATOR_ICON::SetIndicatorState(), and useAlternateBitmap().

Referenced by AppendRenderRows(), OnLeftDownLayers(), and SelectLayer().

636 {
637  // enable the layer tab at index 0
638  m_notebook->SetSelection( 0 );
639 
640  INDICATOR_ICON* oldIndicator = (INDICATOR_ICON*) getLayerComp( m_CurrentRow, 0 );
641  if( oldIndicator )
642  {
644  oldIndicator->SetIndicatorState( ROW_ICON_PROVIDER::STATE::DIMMED );
645  else
647  }
648 
649  INDICATOR_ICON* newIndicator = (INDICATOR_ICON*) getLayerComp( aRow, 0 );
650  if( newIndicator )
651  {
653 
654  // Make sure the desired layer row is visible.
655  // It seems that as of 2.8.2, setting the focus does this.
656  // I don't expect the scrolling to be needed at all because
657  // the minimum window size may end up being established so that the
658  // scroll bars will not be visible.
659  getLayerComp( aRow, 1 )->SetFocus();
660  }
661 
662  m_CurrentRow = aRow;
663 
664  // give the focus back to the app.
665  passOnFocus();
666 }
void SetIndicatorState(ICON_ID aIconId)
Sets the row indiciator to the given state.
wxAuiNotebook * m_notebook
Definition: layer_widget.h:123
int m_CurrentRow
selected row of layer list
Definition: layer_widget.h:132
#define OFF
virtual bool useAlternateBitmap(int aRow)
Virtual Function useAlternateBitmap.
Definition: layer_widget.h:145
Class representing a row indicator icon for use in places like the layer widget.
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
#define ON
void LAYER_WIDGET::setLayerCheckbox ( LAYER_NUM  aLayer,
bool  isVisible 
)
protected

Definition at line 693 of file layer_widget.cpp.

References COLUMN_COLOR_LYR_CB, findLayerRow(), and getLayerComp().

Referenced by getBackgroundLayerColor(), SetLayerVisible(), and PCB_LAYER_WIDGET::SyncLayerVisibilities().

694 {
695  int row = findLayerRow( aLayer );
696  if( row >= 0 )
697  {
698  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
699  wxASSERT( cb );
700  cb->SetValue( isVisible ); // does not fire an event
701  }
702 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:54
void LAYER_WIDGET::SetLayerColor ( LAYER_NUM  aLayer,
COLOR4D  aColor 
)

Function SetLayerColor changes the color of aLayer.

Definition at line 718 of file layer_widget.cpp.

References findLayerRow(), and getLayerComp().

Referenced by AppendRenderRows().

719 {
720  int row = findLayerRow( aLayer );
721  if( row >= 0 )
722  {
723  int col = 1; // bitmap button is column 1
724  auto swatch = static_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
725  wxASSERT( swatch );
726 
727  swatch->SetSwatchColor( aColor, false );
728  }
729 }
int findLayerRow(LAYER_NUM aLayer) const
Function findLayerRow returns the row index that aLayer resides in, or -1 if not found.
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
void LAYER_WIDGET::SetLayerVisible ( LAYER_NUM  aLayer,
bool  isVisible 
)

Function SetLayerVisible sets aLayer visible or not.

This does not invoke OnLayerVisible().

Definition at line 686 of file layer_widget.cpp.

References OnLayerVisible(), and setLayerCheckbox().

Referenced by AppendRenderRows(), and ROUTER_TOOL::prepareInteractive().

687 {
688  setLayerCheckbox( aLayer, isVisible );
689  OnLayerVisible( aLayer, isVisible );
690 }
virtual void OnLayerVisible(LAYER_NUM aLayer, bool isVisible, bool isFinal=true)=0
Function OnLayerVisible is called to notify client code about a layer visibility change.
void setLayerCheckbox(LAYER_NUM aLayer, bool isVisible)
void LAYER_WIDGET::SetRenderState ( int  aId,
bool  isSet 
)

Function SetRenderState sets the state of the checkbox associated with aId within the Render tab group of the widget.

Does not fire an event, i.e. does not invoke OnRenderEnable().

Parameters
aIdis the same unique id used when adding a ROW to the Render tab.
isSet= the new checkbox state

Definition at line 748 of file layer_widget.cpp.

References findRenderRow(), and getRenderComp().

Referenced by AppendRenderRows(), GERBVIEW_FRAME::SetElementVisibility(), FOOTPRINT_EDIT_FRAME::SetElementVisibility(), and GERBVIEW_FRAME::SetGridVisibility().

749 {
750  int row = findRenderRow( aId );
751 
752  if( row >= 0 )
753  {
754  int col = 1; // checkbox is column 1
755  wxCheckBox* cb = (wxCheckBox*) getRenderComp( row, col );
756  wxASSERT( cb );
757  cb->SetValue( isSet ); // does not fire an event
758  }
759 }
int findRenderRow(int aId) const
wxWindow * getRenderComp(int aRow, int aColumn) const
void LAYER_WIDGET::UpdateLayerIcons ( )

Function UpdateLayerIcons Update all layer manager icons (layers only) Useful when loading a file or clearing a layer because they change, and the indicator arrow icon needs to be updated.

Definition at line 788 of file layer_widget.cpp.

References BLUE, BROWN, COLUMN_ICON_ACTIVE, DIM, getLayerComp(), GetLayerRowCount(), GREEN, LAYER_WIDGET(), m_CurrentRow, OFF, ON, OnLayerColorChange(), OnLayerSelect(), OnLayerVisible(), OnRenderColorChange(), OnRenderEnable(), RED, INDICATOR_ICON::SetIndicatorState(), useAlternateBitmap(), and YELLOW.

Referenced by AppendRenderRows(), GERBVIEW_FRAME::LoadExcellonFiles(), GERBVIEW_FRAME::loadListOfGerberFiles(), and GERBVIEW_FRAME::LoadZipArchiveFile().

789 {
790  int rowCount = GetLayerRowCount();
791 
792  for( int row = 0; row < rowCount ; row++ )
793  {
795 
796  if( indicator )
797  {
799 
800  if( row == m_CurrentRow )
802  else if( useAlternateBitmap( row ) )
803  state = ROW_ICON_PROVIDER::STATE::DIMMED;
804  else
806 
807  indicator->SetIndicatorState( state );
808  }
809  }
810 }
void SetIndicatorState(ICON_ID aIconId)
Sets the row indiciator to the given state.
int m_CurrentRow
selected row of layer list
Definition: layer_widget.h:132
#define OFF
virtual bool useAlternateBitmap(int aRow)
Virtual Function useAlternateBitmap.
Definition: layer_widget.h:145
Class representing a row indicator icon for use in places like the layer widget.
#define COLUMN_ICON_ACTIVE
Definition: layer_widget.h:52
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
int GetLayerRowCount() const
Function GetLayerRowCount returns the number of rows in the layer tab.
STATE
State constants to select the right icons
#define ON
void LAYER_WIDGET::UpdateLayouts ( )

Definition at line 778 of file layer_widget.cpp.

References m_LayerPanel, m_LayersFlexGridSizer, m_RenderFlexGridSizer, and m_RenderingPanel.

Referenced by AppendLayerRows(), AppendRenderRows(), PCB_LAYER_WIDGET::ReFill(), GERBER_LAYER_WIDGET::ReFill(), and PCB_LAYER_WIDGET::ReFillRender().

779 {
780  m_LayersFlexGridSizer->Layout();
781  m_RenderFlexGridSizer->Layout();
782  m_LayerPanel->Layout();
783  m_RenderingPanel->Layout();
784  FitInside();
785 }
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:126
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:129
wxPanel * m_RenderingPanel
Definition: layer_widget.h:127
wxPanel * m_LayerPanel
Definition: layer_widget.h:124
virtual bool LAYER_WIDGET::useAlternateBitmap ( int  aRow)
inlineprotectedvirtual

Virtual Function useAlternateBitmap.

Returns
true if bitmaps shown in Render layer list are alternate bitmaps, or false if they are "normal" bitmaps This is a virtual function because Pcbnew uses normal bitmaps but GerbView uses both bitmaps (alternate bitmaps to show layers in use, normal fo others)

Reimplemented in GERBER_LAYER_WIDGET.

Definition at line 145 of file layer_widget.h.

Referenced by SelectLayerRow(), and UpdateLayerIcons().

145 { return false; }

Member Data Documentation

const wxEventType LAYER_WIDGET::EVT_LAYER_COLOR_CHANGE = wxNewEventType()
static

Definition at line 119 of file layer_widget.h.

Referenced by OnLayerSwatchChanged().

int LAYER_WIDGET::m_CurrentRow
protected

selected row of layer list

Definition at line 132 of file layer_widget.h.

Referenced by GetSelectedLayer(), LAYER_WIDGET(), SelectLayerRow(), and UpdateLayerIcons().

wxWindow* LAYER_WIDGET::m_FocusOwner
protected

Definition at line 131 of file layer_widget.h.

Referenced by LAYER_WIDGET(), and passOnFocus().

ROW_ICON_PROVIDER* LAYER_WIDGET::m_IconProvider
protected

Definition at line 135 of file layer_widget.h.

Referenced by insertLayerRow(), LAYER_WIDGET(), and ~LAYER_WIDGET().

wxPanel* LAYER_WIDGET::m_LayerPanel
protected

Definition at line 124 of file layer_widget.h.

Referenced by GetBestSize(), LAYER_WIDGET(), and UpdateLayouts().

wxScrolledWindow* LAYER_WIDGET::m_LayerScrolledWindow
protected
wxFlexGridSizer* LAYER_WIDGET::m_LayersFlexGridSizer
protected
wxAuiNotebook* LAYER_WIDGET::m_notebook
protected
int LAYER_WIDGET::m_PointSize
protected

Definition at line 133 of file layer_widget.h.

Referenced by insertLayerRow(), insertRenderRow(), and LAYER_WIDGET().

wxFlexGridSizer* LAYER_WIDGET::m_RenderFlexGridSizer
protected
wxPanel* LAYER_WIDGET::m_RenderingPanel
protected

Definition at line 127 of file layer_widget.h.

Referenced by GetBestSize(), LAYER_WIDGET(), and UpdateLayouts().

wxScrolledWindow* LAYER_WIDGET::m_RenderScrolledWindow
protected

Definition at line 128 of file layer_widget.h.

Referenced by insertRenderRow(), and LAYER_WIDGET().


The documentation for this class was generated from the following files: