KiCad PCB EDA Suite
GERBER_LAYER_WIDGET Class Reference

Class GERBER_LAYER_WIDGET is here to implement the abtract functions of LAYER_WIDGET so they may be tied into the GERBVIEW_FRAME's data and so we can add a popup menu which is specific to Pcbnew's needs. More...

#include <gerbview_layer_widget.h>

Inheritance diagram for GERBER_LAYER_WIDGET:
LAYER_WIDGET

Public Member Functions

 GERBER_LAYER_WIDGET (GERBVIEW_FRAME *aParent, wxWindow *aFocusOwner, int aPointSize=10)
 Constructor. More...
 
void ReFill ()
 
void ReFillRender ()
 Function ReFillRender Rebuild Render for instance after the config is read. More...
 
void OnLayerRightClick (wxMenu &aMenu) override
 Function OnLayerRightClick is called to notify client code about a layer being right-clicked. More...
 
void OnLayerColorChange (int aLayer, COLOR4D aColor) override
 Function OnLayerColorChange is called to notify client code about a layer color change. More...
 
bool OnLayerSelect (int aLayer) override
 Function OnLayerSelect is called to notify client code whenever the user selects a different layer. More...
 
void OnLayerVisible (int aLayer, bool isVisible, bool isFinal) override
 Function OnLayerVisible is called to notify client code about a layer visibility change. More...
 
void OnRenderColorChange (int aId, COLOR4D aColor) override
 Function OnRenderColorChange is called to notify client code whenever the user changes a rendering color. More...
 
void OnRenderEnable (int aId, bool isEnabled) override
 Function OnRenderEnable is called to notify client code whenever the user changes an rendering enable in one of the rendering checkboxes. More...
 
void SetLayersManagerTabsText ()
 Function SetLayersManagerTabsText Update the layer manager tabs labels Useful when changing Language or to set labels to a non default value. More...
 
bool OnLayerSelected ()
 Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwaysShowActiveLayer is true Otherwise do nothing. More...
 
void AddRightClickMenuItems (wxMenu &menu)
 Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the Gerber layer widget. More...
 
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...
 

Static Public Attributes

static const wxEventType EVT_LAYER_COLOR_CHANGE = wxNewEventType()
 

Protected Types

enum  LAYER_MANAGER {
  ID_LAYER_MANAGER_START = LAYER_WIDGET::ID_LAST_VALUE, ID_SHOW_ALL_LAYERS = ID_LAYER_MANAGER_START, ID_SHOW_NO_LAYERS, ID_SHOW_NO_LAYERS_BUT_ACTIVE,
  ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE, ID_SORT_GBR_LAYERS, ID_LAYER_MANAGER_END = ID_SORT_GBR_LAYERS
}
 
enum  POPUP_ID { ID_CHANGE_LAYER_COLOR = wxID_HIGHEST, ID_CHANGE_RENDER_COLOR, ID_LAST_VALUE }
 

Protected Member Functions

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 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
 

Private Member Functions

void onRightDownLayers (wxMouseEvent &event)
 Function OnRightDownLayers puts up a popup menu for the layer panel. More...
 
void onPopupSelection (wxCommandEvent &event)
 
void installRightLayerClickHandler ()
 this is for the popup menu, the right click handler has to be installed on every child control within the layer panel. More...
 
virtual bool useAlternateBitmap (int aRow) override
 Virtual Function useAlternateBitmap. More...
 
virtual bool AreArbitraryColorsAllowed () override
 Subclasses can override this to provide logic for allowing arbitrary color selection via wxColourPicker instead of DisplayColorFrame. More...
 
GERBER_FILE_IMAGE_LISTGetImagesList ()
 

Private Attributes

GERBVIEW_FRAMEmyframe
 
bool m_alwaysShowActiveLayer
 

Detailed Description

Class GERBER_LAYER_WIDGET is here to implement the abtract functions of LAYER_WIDGET so they may be tied into the GERBVIEW_FRAME's data and so we can add a popup menu which is specific to Pcbnew's needs.

Definition at line 42 of file gerbview_layer_widget.h.

Member Enumeration Documentation

enum LAYER_WIDGET::POPUP_ID
protectedinherited
Enumerator
ID_CHANGE_LAYER_COLOR 
ID_CHANGE_RENDER_COLOR 
ID_LAST_VALUE 

Definition at line 233 of file layer_widget.h.

Constructor & Destructor Documentation

GERBER_LAYER_WIDGET::GERBER_LAYER_WIDGET ( GERBVIEW_FRAME aParent,
wxWindow *  aFocusOwner,
int  aPointSize = 10 
)

Constructor.

Parameters
aParent: the parent frame
aFocusOwner: the window that has the keyboard focus.
aPointSizeis the font point size to use within the widget. This effectively sets the overal size of the widget via the row height and bitmap button sizes.

Definition at line 57 of file gerbview_layer_widget.cpp.

References ID_LAYER_MANAGER_END, ID_LAYER_MANAGER_START, m_alwaysShowActiveLayer, LAYER_WIDGET::m_LayerScrolledWindow, onPopupSelection(), onRightDownLayers(), ReFillRender(), and SetLayersManagerTabsText().

58  :
59  LAYER_WIDGET( aParent, aFocusOwner, aPointSize ),
60  myframe( aParent )
61 {
63 
64  ReFillRender();
65 
66  // Update default tabs labels for GerbView
68 
69  //-----<Popup menu>-------------------------------------------------
70  // handle the popup menu over the layer window.
71  m_LayerScrolledWindow->Connect( wxEVT_RIGHT_DOWN,
72  wxMouseEventHandler( GERBER_LAYER_WIDGET::onRightDownLayers ), NULL, this );
73 
74  // since Popupmenu() calls this->ProcessEvent() we must call this->Connect()
75  // and not m_LayerScrolledWindow->Connect()
77  wxEVT_COMMAND_MENU_SELECTED,
78  wxCommandEventHandler( GERBER_LAYER_WIDGET::onPopupSelection ), NULL, this );
79 }
void onRightDownLayers(wxMouseEvent &event)
Function OnRightDownLayers puts up a popup menu for the layer panel.
GERBVIEW_FRAME * myframe
void SetLayersManagerTabsText()
Function SetLayersManagerTabsText Update the layer manager tabs labels Useful when changing Language ...
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:112
void onPopupSelection(wxCommandEvent &event)
void ReFillRender()
Function ReFillRender Rebuild Render for instance after the config is read.
LAYER_WIDGET(wxWindow *aParent, wxWindow *aFocusOwner, int aPointSize=-1, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
Constructor.

Member Function Documentation

void GERBER_LAYER_WIDGET::AddRightClickMenuItems ( wxMenu &  menu)

Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the Gerber layer widget.

Definition at line 137 of file gerbview_layer_widget.cpp.

References ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE, ID_SHOW_ALL_LAYERS, ID_SHOW_NO_LAYERS, ID_SHOW_NO_LAYERS_BUT_ACTIVE, and ID_SORT_GBR_LAYERS.

Referenced by OnLayerRightClick(), and onRightDownLayers().

138 {
139  // Remember: menu text is capitalized (see our rules_for_capitalization_in_Kicad_UI.txt)
140  menu.Append( new wxMenuItem( &menu, ID_SHOW_ALL_LAYERS,
141  _("Show All Layers") ) );
142 
143  menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_LAYERS_BUT_ACTIVE,
144  _( "Hide All Layers But Active" ) ) );
145 
146  menu.Append( new wxMenuItem( &menu, ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE,
147  _( "Always Hide All Layers But Active" ) ) );
148 
149  menu.Append( new wxMenuItem( &menu, ID_SHOW_NO_LAYERS,
150  _( "Hide All Layers" ) ) );
151 
152  menu.AppendSeparator();
153  menu.Append( new wxMenuItem( &menu, ID_SORT_GBR_LAYERS,
154  _( "Sort Layers if X2 Mode" ) ) );
155 }
void LAYER_WIDGET::AppendLayerRow ( const ROW aRow)
inherited

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 595 of file layer_widget.cpp.

References LAYER_WIDGET::GetLayerRowCount(), LAYER_WIDGET::insertLayerRow(), and LAYER_WIDGET::UpdateLayouts().

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

596 {
597  int nextRow = GetLayerRowCount();
598  insertLayerRow( nextRow, aRow );
599  UpdateLayouts();
600 }
void UpdateLayouts()
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 
)
inlineinherited

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 292 of file layer_widget.h.

References LAYER_WIDGET::AppendLayerRow(), LAYER_WIDGET::AppendRenderRow(), and LAYER_WIDGET::ClearLayerRows().

293  {
294  for( int row=0; row<aRowCount; ++row )
295  AppendLayerRow( aRowsArray[row] );
296  }
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)
inherited

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 609 of file layer_widget.cpp.

References LAYER_WIDGET::GetRenderRowCount(), LAYER_WIDGET::insertRenderRow(), and LAYER_WIDGET::UpdateLayouts().

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

610 {
611  int nextRow = GetRenderRowCount();
612  insertRenderRow( nextRow, aRow );
613  UpdateLayouts();
614 }
void insertRenderRow(int aRow, const ROW &aSpec)
void UpdateLayouts()
int GetRenderRowCount() const
Function GetRenderRowCount returns the number of rows in the render tab.
void LAYER_WIDGET::AppendRenderRows ( const ROW aRowsArray,
int  aRowCount 
)
inlineinherited

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 316 of file layer_widget.h.

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

Referenced by ReFillRender().

317  {
318  for( int row=0; row<aRowCount; ++row )
319  AppendRenderRow( aRowsArray[row] );
320  }
void AppendRenderRow(const ROW &aRow)
Function AppendRenderRow appends a new row in the render portion of the widget.
bool GERBER_LAYER_WIDGET::AreArbitraryColorsAllowed ( )
overrideprivatevirtual

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

Reimplemented from LAYER_WIDGET.

Definition at line 87 of file gerbview_layer_widget.cpp.

References EDA_DRAW_FRAME::IsGalCanvasActive(), and myframe.

88 {
89  return myframe->IsGalCanvasActive();
90 }
GERBVIEW_FRAME * myframe
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:874
void LAYER_WIDGET::ClearLayerRows ( )
inherited

Function ClearLayerRows empties out the layer rows.

Definition at line 603 of file layer_widget.cpp.

References LAYER_WIDGET::m_LayersFlexGridSizer.

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

604 {
605  m_LayersFlexGridSizer->Clear( true );
606 }
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:113
void LAYER_WIDGET::ClearRenderRows ( )
inherited

Function ClearRenderRows empties out the render rows.

Definition at line 617 of file layer_widget.cpp.

References LAYER_WIDGET::m_RenderFlexGridSizer.

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

618 {
619  m_RenderFlexGridSizer->Clear( true );
620 }
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:116
int LAYER_WIDGET::encodeId ( int  aColumn,
int  aId 
)
staticprotectedinherited

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 68 of file layer_widget.cpp.

References LYR_COLUMN_COUNT.

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

69 {
70  int id = aId * LYR_COLUMN_COUNT + aColumn;
71  return id;
72 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:48
int LAYER_WIDGET::findLayerRow ( LAYER_NUM  aLayer) const
protectedinherited

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

Definition at line 270 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::getBackgroundLayerColor(), LAYER_WIDGET::GetLayerColor(), LAYER_WIDGET::IsLayerVisible(), LAYER_WIDGET::OnLeftDownLayers(), LAYER_WIDGET::SelectLayer(), LAYER_WIDGET::SetLayerColor(), and LAYER_WIDGET::SetLayerVisible().

271 {
272  int count = GetLayerRowCount();
273 
274  for( int row = 0; row < count; ++row )
275  {
276  // column 0 in the layer scroll window has a wxStaticBitmap, get its ID.
277  wxWindow* w = getLayerComp( row, 0 );
278  wxASSERT( w );
279 
280  if( aLayer == getDecodedId( w->GetId() ))
281  return row;
282  }
283 
284  return -1;
285 }
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
protectedinherited

Definition at line 299 of file layer_widget.cpp.

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

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

300 {
301  int count = GetRenderRowCount();
302 
303  for( int row = 0; row < count; ++row )
304  {
305  // column 0 in the layer scroll window has a wxStaticBitmap, get its ID.
306  wxWindow* w = getRenderComp( row, 0 );
307  wxASSERT( w );
308 
309  if( aId == getDecodedId( w->GetId() ))
310  return row;
311  }
312 
313  return -1;
314 }
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
wxSize LAYER_WIDGET::GetBestSize ( ) const
inherited

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 526 of file layer_widget.cpp.

References LYR_COLUMN_COUNT, LAYER_WIDGET::m_LayerPanel, LAYER_WIDGET::m_LayersFlexGridSizer, LAYER_WIDGET::m_RenderFlexGridSizer, LAYER_WIDGET::m_RenderingPanel, max, and RND_COLUMN_COUNT.

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

527 {
528  // size of m_LayerScrolledWindow --------------
529  wxArrayInt widths = m_LayersFlexGridSizer->GetColWidths();
530  int totWidth = 0;
531 
532  if( widths.GetCount() )
533  {
534  for( int i = 0; i < LYR_COLUMN_COUNT; ++i )
535  {
536  totWidth += widths[i] + m_LayersFlexGridSizer->GetHGap();
537  // printf("widths[%d]:%d\n", i, widths[i] );
538  }
539  }
540 
541  // Account for the parent's frame:
542  totWidth += 10;
543 
544 
545  /* The minimum height is a small size to properly force computation
546  * of the panel's scrollbars (otherwise it will assume it *has* all
547  * this space) */
548  unsigned totHeight = 32;
549 
550  wxSize layerz( totWidth, totHeight );
551 
552  layerz += m_LayerPanel->GetWindowBorderSize();
553 
554 
555  // size of m_RenderScrolledWindow --------------
556  widths = m_RenderFlexGridSizer->GetColWidths();
557  totWidth = 0;
558 
559  if( widths.GetCount() )
560  {
561  for( int i = 0; i < RND_COLUMN_COUNT; ++i )
562  {
563  totWidth += widths[i] + m_RenderFlexGridSizer->GetHGap();
564  // printf("widths[%d]:%d\n", i, widths[i] );
565  }
566  }
567  // account for the parent's frame, this one has void space of 10 PLUS a border:
568  totWidth += 20;
569 
570  // For totHeight re-use the previous small one
571  wxSize renderz( totWidth, totHeight );
572 
573  renderz += m_RenderingPanel->GetWindowBorderSize();
574 
575  wxSize clientz( std::max(renderz.x,layerz.x), std::max(renderz.y,layerz.y) );
576 
577  return clientz;
578 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:48
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:113
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:49
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:116
wxPanel * m_RenderingPanel
Definition: layer_widget.h:114
#define max(a, b)
Definition: auxiliary.h:86
wxPanel * m_LayerPanel
Definition: layer_widget.h:111
LAYER_NUM LAYER_WIDGET::getDecodedId ( int  aControlId)
staticprotectedinherited

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 75 of file layer_widget.cpp.

References LYR_COLUMN_COUNT.

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

76 {
77  int id = aControlId / LYR_COLUMN_COUNT; // rounding is OK.
78  return id;
79 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:48
GERBER_FILE_IMAGE_LIST * GERBER_LAYER_WIDGET::GetImagesList ( )
private

Definition at line 81 of file gerbview_layer_widget.cpp.

References GERBER_FILE_IMAGE_LIST::GetImagesList().

Referenced by onPopupSelection(), ReFill(), and useAlternateBitmap().

82 {
84 }
static GERBER_FILE_IMAGE_LIST & GetImagesList()
COLOR4D LAYER_WIDGET::GetLayerColor ( LAYER_NUM  aLayer) const
inherited

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

Definition at line 708 of file layer_widget.cpp.

References LAYER_WIDGET::findLayerRow(), and LAYER_WIDGET::getLayerComp().

Referenced by LAYER_WIDGET::AppendRenderRows(), and onPopupSelection().

709 {
710  int row = findLayerRow( aLayer );
711  if( row >= 0 )
712  {
713  int col = 1; // bitmap button is column 1
714  auto swatch = static_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
715  wxASSERT( swatch );
716 
717  return swatch->GetSwatchColor();
718  }
719 
720  return COLOR4D::UNSPECIFIED; // it's caller fault, gave me a bad layer
721 }
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
protectedinherited

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 259 of file layer_widget.cpp.

References LYR_COLUMN_COUNT, and LAYER_WIDGET::m_LayersFlexGridSizer.

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

260 {
261  unsigned ndx = aRow * LYR_COLUMN_COUNT + aColumn;
262 
263  if( ndx < m_LayersFlexGridSizer->GetChildren().GetCount() )
264  return m_LayersFlexGridSizer->GetChildren()[ndx]->GetWindow();
265 
266  return NULL;
267 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:48
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:113
int LAYER_WIDGET::GetLayerRowCount ( ) const
inherited

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

Definition at line 581 of file layer_widget.cpp.

References LYR_COLUMN_COUNT, and LAYER_WIDGET::m_LayersFlexGridSizer.

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

582 {
583  int controlCount = m_LayersFlexGridSizer->GetChildren().GetCount();
584  return controlCount / LYR_COLUMN_COUNT;
585 }
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:48
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:113
wxWindow * LAYER_WIDGET::getRenderComp ( int  aRow,
int  aColumn 
) const
protectedinherited

Definition at line 288 of file layer_widget.cpp.

References LAYER_WIDGET::m_RenderFlexGridSizer, and RND_COLUMN_COUNT.

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

289 {
290  int ndx = aRow * RND_COLUMN_COUNT + aColumn;
291 
292  if( (unsigned) ndx < m_RenderFlexGridSizer->GetChildren().GetCount() )
293  return m_RenderFlexGridSizer->GetChildren()[ndx]->GetWindow();
294 
295  return NULL;
296 }
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:49
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:116
int LAYER_WIDGET::GetRenderRowCount ( ) const
inherited

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

Definition at line 588 of file layer_widget.cpp.

References LAYER_WIDGET::m_RenderFlexGridSizer, and RND_COLUMN_COUNT.

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

589 {
590  int controlCount = m_RenderFlexGridSizer->GetChildren().GetCount();
591  return controlCount / RND_COLUMN_COUNT;
592 }
#define RND_COLUMN_COUNT
Rendering tab column count.
Definition: layer_widget.h:49
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:116
bool LAYER_WIDGET::GetRenderState ( int  aId)
inherited

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

Returns
bool - true if checked, else false.

Definition at line 738 of file layer_widget.cpp.

References LAYER_WIDGET::findRenderRow(), and LAYER_WIDGET::getRenderComp().

Referenced by LAYER_WIDGET::AppendRenderRows().

739 {
740  int row = findRenderRow( aId );
741 
742  if( row >= 0 )
743  {
744  int col = 1; // checkbox is column 1
745  wxCheckBox* cb = (wxCheckBox*) getRenderComp( row, col );
746  wxASSERT( cb );
747  return cb->GetValue();
748  }
749 
750  return false; // the value of a non-existent row
751 }
int findRenderRow(int aId) const
wxWindow * getRenderComp(int aRow, int aColumn) const
LAYER_NUM LAYER_WIDGET::GetSelectedLayer ( )
inherited

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

Definition at line 659 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::AppendRenderRows().

660 {
661  wxWindow* w = getLayerComp( m_CurrentRow, 0 );
662  if( w )
663  return getDecodedId( w->GetId() );
664 
665  return UNDEFINED_LAYER;
666 }
int m_CurrentRow
selected row of layer list
Definition: layer_widget.h:119
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 
)
protectedinherited

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

Definition at line 317 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::AppendLayerRow(), and LAYER_WIDGET::getBackgroundLayerColor().

318 {
319  wxASSERT( aRow >= 0 );
320 
321  int col;
322  int index = aRow * LYR_COLUMN_COUNT;
323  const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
324 
325  auto& iconProvider = useAlternateBitmap(aRow) ? alternativeRowIcons : defaultRowIcons;
326 
327  // column 0
328  col = COLUMN_ICON_ACTIVE;
329  auto sbm = new INDICATOR_ICON( m_LayerScrolledWindow, iconProvider,
331  encodeId( col, aSpec.id ) );
332  sbm->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this );
333  m_LayersFlexGridSizer->wxSizer::Insert( index+col, sbm, 0, flags );
334 
335  // column 1 (COLUMN_COLORBM)
336  col = COLUMN_COLORBM;
337 
338  auto bmb = new COLOR_SWATCH( m_LayerScrolledWindow, aSpec.color, encodeId( col, aSpec.id ),
340  bmb->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this );
341  bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnLayerSwatchChanged, this );
342  bmb->SetToolTip( _("Left double click or middle click for color change, right click for menu" ) );
343  m_LayersFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags );
344 
345  // column 2 (COLUMN_COLOR_LYR_CB)
346  col = COLUMN_COLOR_LYR_CB;
347  wxCheckBox* cb = new wxCheckBox( m_LayerScrolledWindow, encodeId( col, aSpec.id ), wxEmptyString );
348  cb->SetValue( aSpec.state );
349  cb->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LAYER_WIDGET::OnLayerCheckBox, this );
350  cb->SetToolTip( _( "Enable this for visibility" ) );
351  m_LayersFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags );
352 
353  // column 3 (COLUMN_COLOR_LYRNAME)
354  col = COLUMN_COLOR_LYRNAME;
355  wxStaticText* st = new wxStaticText( m_LayerScrolledWindow, encodeId( col, aSpec.id ), aSpec.rowName );
356  shrinkFont( st, m_PointSize );
357  st->Bind( wxEVT_LEFT_DOWN, &LAYER_WIDGET::OnLeftDownLayers, this );
358  st->SetToolTip( aSpec.tooltip );
359  m_LayersFlexGridSizer->wxSizer::Insert( index+col, st, 0, flags );
360 
361  // Bind right click eventhandler to all columns
362  wxString layerName( aSpec.rowName );
363 
364  sbm->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
365  OnRightDownLayer( aEvt, bmb, layerName );
366  } );
367  bmb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
368  OnRightDownLayer( aEvt, bmb, layerName );
369  } );
370  cb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
371  OnRightDownLayer( aEvt, bmb, layerName );
372  } );
373  st->Bind( wxEVT_RIGHT_DOWN, [this, bmb, layerName] ( wxMouseEvent& aEvt ) {
374  OnRightDownLayer( aEvt, bmb, layerName );
375  } );
376 }
#define COLUMN_COLOR_LYRNAME
Definition: layer_widget.h:54
void OnLeftDownLayers(wxMouseEvent &event)
#define LYR_COLUMN_COUNT
Layer tab column count.
Definition: layer_widget.h:48
#define OFF
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:113
virtual bool useAlternateBitmap(int aRow)
Virtual Function useAlternateBitmap.
Definition: layer_widget.h:130
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:51
#define COLUMN_COLORBM
Definition: layer_widget.h:52
static ROW_ICON_PROVIDER alternativeRowIcons(true)
virtual bool AreArbitraryColorsAllowed()
Subclasses can override this to provide logic for allowing arbitrary color selection via wxColourPick...
Definition: layer_widget.h:136
wxScrolledWindow * m_LayerScrolledWindow
Definition: layer_widget.h:112
static ROW_ICON_PROVIDER defaultRowIcons(false)
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:53
virtual COLOR4D getBackgroundLayerColor()
Subclasses can override this to provide accurate representation of transparent colour swatches...
Definition: layer_widget.h:142
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.
void LAYER_WIDGET::insertRenderRow ( int  aRow,
const ROW aSpec 
)
protectedinherited

Definition at line 379 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::AppendRenderRow(), and LAYER_WIDGET::getBackgroundLayerColor().

380 {
381  wxASSERT( aRow >= 0 );
382 
383  int col;
384  int index = aRow * RND_COLUMN_COUNT;
385  const int flags = wxALIGN_CENTER_VERTICAL | wxALIGN_LEFT;
386 
387  wxString renderName( aSpec.rowName );
388 
389  // column 1
390  col = 1;
391  wxCheckBox* cb = new wxCheckBox( m_RenderScrolledWindow, encodeId( col, aSpec.id ),
392  aSpec.rowName, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT );
393  shrinkFont( cb, m_PointSize );
394  cb->SetValue( aSpec.state );
395  cb->Enable( aSpec.changeable );
396  cb->Bind( wxEVT_COMMAND_CHECKBOX_CLICKED, &LAYER_WIDGET::OnRenderCheckBox, this );
397  cb->SetToolTip( aSpec.tooltip );
398 
399  // column 0
400  col = 0;
401  if( aSpec.color != COLOR4D::UNSPECIFIED )
402  {
403  auto bmb = new COLOR_SWATCH( m_RenderScrolledWindow, aSpec.color, encodeId( col, aSpec.id ),
405  bmb->Bind( COLOR_SWATCH_CHANGED, &LAYER_WIDGET::OnRenderSwatchChanged, this );
406  bmb->SetToolTip( _( "Left double click or middle click for color change" ) );
407  m_RenderFlexGridSizer->wxSizer::Insert( index+col, bmb, 0, flags );
408 
409  bmb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, renderName] ( wxMouseEvent& aEvt ) {
410  OnRightDownRender( aEvt, bmb, renderName );
411  } );
412  cb->Bind( wxEVT_RIGHT_DOWN, [this, bmb, renderName] ( wxMouseEvent& aEvt ) {
413  OnRightDownRender( aEvt, bmb, renderName );
414  } );
415 
416  // could add a left click handler on the color button that toggles checkbox.
417  }
418  else // == -1, no color selection wanted
419  {
420  // need a place holder within the sizer to keep grid full.
421  wxPanel* invisible = new wxPanel( m_RenderScrolledWindow, encodeId( col, aSpec.id ) );
422  m_RenderFlexGridSizer->wxSizer::Insert( index+col, invisible, 0, flags );
423  }
424 
425  // Items have to be inserted in order
426  col = 1;
427  m_RenderFlexGridSizer->wxSizer::Insert( index+col, cb, 0, flags );
428 }
wxScrolledWindow * m_RenderScrolledWindow
Definition: layer_widget.h:115
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:49
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:116
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:136
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:142
Class representing a simple color swatch, of the kind used to set layer colors.
Definition: color_swatch.h:38
void GERBER_LAYER_WIDGET::installRightLayerClickHandler ( )
private

this is for the popup menu, the right click handler has to be installed on every child control within the layer panel.

bool LAYER_WIDGET::IsLayerVisible ( LAYER_NUM  aLayer)
inherited

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

Definition at line 681 of file layer_widget.cpp.

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

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

682 {
683  int row = findLayerRow( aLayer );
684  if( row >= 0 )
685  {
686  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
687  wxASSERT( cb );
688  return cb->GetValue();
689  }
690  return false;
691 }
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:53
void LAYER_WIDGET::OnLayerCheckBox ( wxCommandEvent &  event)
protectedinherited

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

Definition at line 173 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::getBackgroundLayerColor(), and LAYER_WIDGET::insertLayerRow().

174 {
175  wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
176  LAYER_NUM layer = getDecodedId( eventSource->GetId() );
177  OnLayerVisible( layer, eventSource->IsChecked() );
178  passOnFocus();
179 }
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.
void GERBER_LAYER_WIDGET::OnLayerColorChange ( int  aLayer,
COLOR4D  aColor 
)
overridevirtual

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

Implements LAYER_WIDGET.

Definition at line 279 of file gerbview_layer_widget.cpp.

References EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), EDA_DRAW_PANEL_GAL::GetView(), KIGFX::RENDER_SETTINGS::ImportLegacyColors(), EDA_DRAW_FRAME::IsGalCanvasActive(), GERBVIEW_FRAME::m_colorsSettings, GERBVIEW_FRAME::m_SelLayerBox, myframe, EDA_DRAW_PANEL::Refresh(), LAYER_BOX_SELECTOR::ResyncBitmapOnly(), GERBVIEW_FRAME::SetLayerColor(), and KIGFX::VIEW::UpdateLayerColor().

280 {
281  myframe->SetLayerColor( aLayer, aColor );
283 
284  if( myframe->IsGalCanvasActive() )
285  {
286  KIGFX::VIEW* view = myframe->GetGalCanvas()->GetView();
288  view->UpdateLayerColor( aLayer );
289  }
290 
291  myframe->GetCanvas()->Refresh();
292 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:342
GERBVIEW_FRAME * myframe
GBR_LAYER_BOX_SELECTOR * m_SelLayerBox
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
COLORS_DESIGN_SETTINGS * m_colorsSettings
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:874
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
virtual void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings)=0
Function ImportLegacyColors Loads a list of color settings for layers.
void UpdateLayerColor(int aLayer)
Function UpdateLayerColor() Applies the new coloring scheme held by RENDER_SETTINGS in case that it h...
Definition: view.cpp:654
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
void SetLayerColor(int aLayer, COLOR4D aColor)
Function SetLayerColor changes a layer color for any valid layer.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:882
Class VIEW.
Definition: view.h:58
void GERBER_LAYER_WIDGET::OnLayerRightClick ( wxMenu &  aMenu)
overridevirtual

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.

Implements LAYER_WIDGET.

Definition at line 274 of file gerbview_layer_widget.cpp.

References AddRightClickMenuItems().

275 {
276  AddRightClickMenuItems( aMenu );
277 }
void AddRightClickMenuItems(wxMenu &menu)
Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the...
bool GERBER_LAYER_WIDGET::OnLayerSelect ( int  aLayer)
overridevirtual

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

Implements LAYER_WIDGET.

Definition at line 294 of file gerbview_layer_widget.cpp.

References GERBER_DRAW_LAYER_INDEX, GERBVIEW_FRAME::GetActiveLayer(), EDA_DRAW_FRAME::GetCanvas(), myframe, OnLayerSelected(), EDA_DRAW_PANEL::Refresh(), GERBVIEW_FRAME::SetActiveLayer(), and GERBVIEW_FRAME::syncLayerBox().

295 {
296  // the layer change from the GERBER_LAYER_WIDGET can be denied by returning
297  // false from this function.
298  int layer = myframe->GetActiveLayer( );
299  // TODO(JE) ActiveLayer is stored as an index from 0 rather than as a layer
300  // id matching GERBER_DRAW_LAYER( idx ), is this what we want long-term?
301  myframe->SetActiveLayer( GERBER_DRAW_LAYER_INDEX( aLayer ), false );
303 
304  if( layer != myframe->GetActiveLayer( ) )
305  {
306  if( ! OnLayerSelected() )
307  myframe->GetCanvas()->Refresh();
308  }
309 
310  return true;
311 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:342
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
GERBVIEW_FRAME * myframe
void SetActiveLayer(int aLayer, bool doLayerWidgetUpdate=true)
Function SetActiveLayer will change the currently active layer to aLayer and also update the GERBER_L...
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
#define GERBER_DRAW_LAYER_INDEX(x)
bool OnLayerSelected()
Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwa...
bool GERBER_LAYER_WIDGET::OnLayerSelected ( )

Function OnLayerSelected ensure the active layer is visible, and other layers not visible when m_alwaysShowActiveLayer is true Otherwise do nothing.

Returns
true m_alwaysShowActiveLayer is true and the canvas is refreshed, and false if do nothing

Definition at line 230 of file gerbview_layer_widget.cpp.

References ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE, m_alwaysShowActiveLayer, and onPopupSelection().

Referenced by GERBVIEW_FRAME::OnHotKey(), OnLayerSelect(), and GERBVIEW_FRAME::OnSelectActiveLayer().

231 {
233  return false;
234 
235  // postprocess after active layer selection
236  // ensure active layer visible
237  wxCommandEvent event;
239  onPopupSelection( event );
240  return true;
241 }
void onPopupSelection(wxCommandEvent &event)
void LAYER_WIDGET::OnLayerSwatchChanged ( wxCommandEvent &  aEvent)
protectedinherited

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

Definition at line 154 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::getBackgroundLayerColor(), and LAYER_WIDGET::insertLayerRow().

155 {
156  auto eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
157 
158  COLOR4D newColor = eventSource->GetSwatchColor();
159 
160  LAYER_NUM layer = getDecodedId( eventSource->GetId() );
161 
162  // tell the client code.
163  OnLayerColorChange( layer, newColor );
164 
165  // notify others
166  wxCommandEvent event( EVT_LAYER_COLOR_CHANGE );
167  wxPostEvent( this, event );
168 
169  passOnFocus();
170 }
static const wxEventType EVT_LAYER_COLOR_CHANGE
Definition: layer_widget.h:106
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
void GERBER_LAYER_WIDGET::OnLayerVisible ( int  aLayer,
bool  isVisible,
bool  isFinal 
)
overridevirtual

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.

Implements LAYER_WIDGET.

Definition at line 313 of file gerbview_layer_widget.cpp.

References GERBVIEW_LAYER_ID_START, EDA_DRAW_FRAME::GetCanvas(), GERBVIEW_FRAME::GetVisibleLayers(), myframe, EDA_DRAW_PANEL::Refresh(), and GERBVIEW_FRAME::SetVisibleLayers().

314 {
315  long visibleLayers = myframe->GetVisibleLayers();
316 
317  if( isVisible )
318  visibleLayers |= 1 << ( aLayer - GERBVIEW_LAYER_ID_START );
319  else
320  visibleLayers &= ~( 1 << ( aLayer - GERBVIEW_LAYER_ID_START ) );
321 
322  myframe->SetVisibleLayers( visibleLayers );
323 
324  if( isFinal )
325  myframe->GetCanvas()->Refresh();
326 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:342
GERBVIEW_FRAME * myframe
void SetVisibleLayers(long aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
long GetVisibleLayers() const
Function GetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
void LAYER_WIDGET::OnLeftDownLayers ( wxMouseEvent &  event)
protectedinherited

Definition at line 82 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::getBackgroundLayerColor(), and LAYER_WIDGET::insertLayerRow().

83 {
84  int row;
85  LAYER_NUM layer;
86 
87  wxWindow* eventSource = (wxWindow*) event.GetEventObject();
88 
89  // if mouse event is coming from the m_LayerScrolledWindow and not one
90  // of its children, we have to find the row manually based on y coord.
91  if( eventSource == m_LayerScrolledWindow )
92  {
93  int y = event.GetY();
94 
95  wxArrayInt heights = m_LayersFlexGridSizer->GetRowHeights();
96 
97  int height = 0;
98 
99  int rowCount = GetLayerRowCount();
100  for( row = 0; row<rowCount; ++row )
101  {
102  if( y < height + heights[row] )
103  break;
104 
105  height += heights[row];
106  }
107 
108  if( row >= rowCount )
109  row = rowCount - 1;
110 
111  layer = getDecodedId( getLayerComp( row, 0 )->GetId() );
112  }
113 
114  else
115  {
116  // all nested controls on a given row will have their ID encoded with
117  // encodeId(), and the corresponding decoding is getDecodedId()
118  int id = eventSource->GetId();
119  layer = getDecodedId( id );
120  row = findLayerRow( layer );
121  }
122 
123  if( OnLayerSelect( layer ) ) // if client allows this change.
124  SelectLayerRow( row );
125 
126  passOnFocus();
127 }
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:113
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:112
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 GERBER_LAYER_WIDGET::onPopupSelection ( wxCommandEvent &  event)
private

Definition at line 168 of file gerbview_layer_widget.cpp.

References COLUMN_COLOR_LYR_CB, GERBER_DRAW_LAYER, GERBER_DRAWLAYERS_COUNT, GERBVIEW_FRAME::GetActiveLayer(), EDA_DRAW_FRAME::GetCanvas(), LAYER_WIDGET::getDecodedId(), GetImagesList(), LAYER_WIDGET::GetLayerColor(), LAYER_WIDGET::getLayerComp(), LAYER_WIDGET::GetLayerRowCount(), ID_ALWAYS_SHOW_NO_LAYERS_BUT_ACTIVE, ID_SHOW_ALL_LAYERS, ID_SHOW_NO_LAYERS, ID_SHOW_NO_LAYERS_BUT_ACTIVE, ID_SORT_GBR_LAYERS, EDA_DRAW_FRAME::IsGalCanvasActive(), m_alwaysShowActiveLayer, myframe, GERBVIEW_FRAME::ReFillLayerWidget(), EDA_DRAW_PANEL::Refresh(), GERBVIEW_FRAME::SetLayerColor(), GERBVIEW_FRAME::SetVisibleLayers(), GERBER_FILE_IMAGE_LIST::SortImagesByZOrder(), and GERBVIEW_FRAME::syncLayerBox().

Referenced by GERBER_LAYER_WIDGET(), and OnLayerSelected().

169 {
170  int rowCount;
171  int menuId = event.GetId();
172  bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;
173  long visibleLayers = 0;
174  bool force_active_layer_visible;
175 
177  force_active_layer_visible = ( menuId == ID_SHOW_NO_LAYERS_BUT_ACTIVE ||
179 
180  switch( menuId )
181  {
182  case ID_SHOW_ALL_LAYERS:
183  case ID_SHOW_NO_LAYERS:
186  rowCount = GetLayerRowCount();
187  for( int row=0; row < rowCount; ++row )
188  {
189  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
190  int layer = getDecodedId( cb->GetId() );
191  bool loc_visible = visible;
192 
193  if( force_active_layer_visible &&
194  (layer == GERBER_DRAW_LAYER( myframe->GetActiveLayer() ) ) )
195  {
196  loc_visible = true;
197  }
198 
199  cb->SetValue( loc_visible );
200 
201  if( loc_visible )
202  visibleLayers |= 1 << row;
203  else
204  visibleLayers &= ~( 1 << row );
205  }
206 
207  myframe->SetVisibleLayers( visibleLayers );
208  myframe->GetCanvas()->Refresh();
209  break;
210 
211  case ID_SORT_GBR_LAYERS:
214  myframe->syncLayerBox( true );
215 
216  if( myframe->IsGalCanvasActive() )
217  {
218  for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
219  {
221  GetLayerColor( GERBER_DRAW_LAYER( layer ) ) );
222  }
223  }
224 
225  myframe->GetCanvas()->Refresh();
226  break;
227  }
228 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:342
void syncLayerBox(bool aRebuildLayerBox=false)
Function syncLayerBox updates the currently "selected" layer within m_SelLayerBox The currently activ...
GERBVIEW_FRAME * myframe
void SortImagesByZOrder()
Sort loaded images by Z order priority, if they have the X2 FileFormat info (SortImagesByZOrder updat...
COLOR4D GetLayerColor(LAYER_NUM aLayer) const
Function GetLayerColor returns the color of the layer ROW associated with aLayer id.
GERBER_FILE_IMAGE_LIST * GetImagesList()
int GetActiveLayer()
Function SetActiveLayer returns the active layer.
void SetVisibleLayers(long aLayerMask)
Function SetVisibleLayers is a proxy function that calls the correspondent function in m_BoardSetting...
#define GERBER_DRAWLAYERS_COUNT
wxWindow * getLayerComp(int aRow, int aColumn) const
Function getLayerComp returns the component within the m_LayersFlexGridSizer at aRow and aCol or NULL...
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:874
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.
#define COLUMN_COLOR_LYR_CB
Definition: layer_widget.h:53
void SetLayerColor(int aLayer, COLOR4D aColor)
Function SetLayerColor changes a layer color for any valid layer.
#define GERBER_DRAW_LAYER(x)
void ReFillLayerWidget()
Function ReFillLayerWidget changes out all the layers in m_Layers and may be called upon loading new ...
void LAYER_WIDGET::OnRenderCheckBox ( wxCommandEvent &  event)
protectedinherited

Definition at line 241 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::getBackgroundLayerColor(), and LAYER_WIDGET::insertRenderRow().

242 {
243  wxCheckBox* eventSource = (wxCheckBox*) event.GetEventObject();
244  LAYER_NUM id = getDecodedId( eventSource->GetId() );
245  OnRenderEnable( id, eventSource->IsChecked() );
246  passOnFocus();
247 }
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.
void GERBER_LAYER_WIDGET::OnRenderColorChange ( int  aId,
COLOR4D  aColor 
)
overridevirtual

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

Implements LAYER_WIDGET.

Definition at line 328 of file gerbview_layer_widget.cpp.

References EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_FRAME::GetGalCanvas(), KIGFX::VIEW::GetPainter(), KIGFX::PAINTER::GetSettings(), EDA_DRAW_PANEL_GAL::GetView(), KIGFX::RENDER_SETTINGS::ImportLegacyColors(), EDA_DRAW_FRAME::IsGalCanvasActive(), GERBVIEW_FRAME::m_colorsSettings, myframe, EDA_DRAW_PANEL::Refresh(), GERBVIEW_FRAME::SetVisibleElementColor(), and KIGFX::TARGET_NONCACHED.

329 {
331 
332  auto galCanvas = myframe->GetGalCanvas();
333 
334  if( galCanvas && myframe->IsGalCanvasActive() )
335  {
336  auto view = galCanvas->GetView();
338  view->UpdateLayerColor( aId );
339  // TODO(JE) Why are the below two lines needed? Not needed in pcbnew
340  view->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
341  view->RecacheAllItems();
342  }
343 
344  if( galCanvas && myframe->IsGalCanvasActive() )
345  galCanvas->Refresh();
346  else
347  myframe->GetCanvas()->Refresh();
348 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:342
void SetVisibleElementColor(GERBVIEW_LAYER_ID aItemIdVisible, COLOR4D aColor)
GERBVIEW_FRAME * myframe
KIGFX::VIEW * GetView() const
Function GetView() Returns a pointer to the VIEW instance used in the panel.
GERBVIEW_LAYER_ID
GerbView draw layers.
Auxiliary rendering target (noncached)
Definition: definitions.h:42
COLORS_DESIGN_SETTINGS * m_colorsSettings
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:874
PAINTER * GetPainter() const
Function GetPainter() Returns the painter object used by the view for drawing VIEW_ITEMS.
Definition: view.h:196
virtual void ImportLegacyColors(const COLORS_DESIGN_SETTINGS *aSettings)=0
Function ImportLegacyColors Loads a list of color settings for layers.
virtual RENDER_SETTINGS * GetSettings()=0
Function GetSettings Returns pointer to current settings that are going to be used when drawing items...
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:882
void GERBER_LAYER_WIDGET::OnRenderEnable ( int  aId,
bool  isEnabled 
)
overridevirtual

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.

Implements LAYER_WIDGET.

Definition at line 350 of file gerbview_layer_widget.cpp.

References EDA_DRAW_FRAME::GetCanvas(), EDA_DRAW_PANEL_GAL::GetGAL(), EDA_DRAW_FRAME::GetGalCanvas(), EDA_DRAW_FRAME::IsGalCanvasActive(), EDA_DRAW_FRAME::IsGridVisible(), LAYER_GERBVIEW_GRID, myframe, EDA_DRAW_PANEL::Refresh(), GERBVIEW_FRAME::SetElementVisibility(), KIGFX::GAL::SetGridVisibility(), and KIGFX::TARGET_NONCACHED.

351 {
352  myframe->SetElementVisibility( (GERBVIEW_LAYER_ID) aId, isEnabled );
353 
354  auto galCanvas = myframe->GetGalCanvas();
355 
356  if( galCanvas )
357  {
358  if( aId == LAYER_GERBVIEW_GRID )
359  {
360  galCanvas->GetGAL()->SetGridVisibility( myframe->IsGridVisible() );
361  galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
362  // TODO(JE) Why is the below line needed? Not needed in pcbnew
363  galCanvas->GetView()->RecacheAllItems();
364  }
365  else
366  galCanvas->GetView()->SetLayerVisible( aId, isEnabled );
367  }
368 
369  if( galCanvas && myframe->IsGalCanvasActive() )
370  galCanvas->Refresh();
371  else
372  myframe->GetCanvas()->Refresh();
373 }
virtual void Refresh(bool eraseBackground=true, const wxRect *rect=NULL) override
Update the board display after modifying it bu a python script (note: it is automatically called by a...
Definition: draw_panel.cpp:339
EDA_DRAW_PANEL * GetCanvas()
Definition: draw_frame.h:342
GERBVIEW_FRAME * myframe
GERBVIEW_LAYER_ID
GerbView draw layers.
virtual bool IsGridVisible() const
Function IsGridVisible() , virtual.
Definition: draw_frame.h:486
Auxiliary rendering target (noncached)
Definition: definitions.h:42
KIGFX::GAL * GetGAL() const
Function GetGAL() Returns a pointer to the GAL instance used in the panel.
bool IsGalCanvasActive() const
Function IsGalCanvasActive is used to check which canvas (GAL-based or standard) is currently in use...
Definition: draw_frame.h:874
void SetElementVisibility(GERBVIEW_LAYER_ID aItemIdVisible, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
void SetGridVisibility(bool aVisibility)
Sets the visibility setting of the grid.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:882
void LAYER_WIDGET::OnRenderSwatchChanged ( wxCommandEvent &  aEvent)
protectedinherited

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

Definition at line 203 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::getBackgroundLayerColor(), and LAYER_WIDGET::insertRenderRow().

204 {
205  auto eventSource = static_cast<COLOR_SWATCH*>( aEvent.GetEventObject() );
206 
207  COLOR4D newColor = eventSource->GetSwatchColor();
208 
209  LAYER_NUM id = getDecodedId( eventSource->GetId() );
210 
211  if( id == LAYER_PCB_BACKGROUND )
212  {
213  // Update all swatch backgrounds
214  int count = GetLayerRowCount();
215  int row;
216  int col = 1; // bitmap button is column 1 in layers tab
217  for( row = 0; row < count; ++row )
218  {
219  COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
220  if( swatch )
221  swatch->SetSwatchBackground( newColor );
222  }
223 
224  count = GetRenderRowCount();
225  col = 0; // bitmap button is column 0 in render tab
226  for( row = 0; row < count; ++row )
227  {
228  COLOR_SWATCH* swatch = dynamic_cast<COLOR_SWATCH*>( getRenderComp( row, col ) );
229  if( swatch )
230  swatch->SetSwatchBackground( newColor );
231  }
232  }
233 
234  // tell the client code.
235  OnRenderColorChange( id, newColor );
236 
237  passOnFocus();
238 }
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 
)
protectedinherited

Function OnRightDownLayer Called when user right-clicks a layer.

Definition at line 130 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::getBackgroundLayerColor(), and LAYER_WIDGET::insertLayerRow().

131 {
132  wxMenu menu;
133 
135  _( "Change Layer Color for " ) + aLayerName,
136  KiBitmap( setcolor_copper_xpm ) );
137  menu.AppendSeparator();
138 
139  OnLayerRightClick( menu );
140 
141  menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [this, aColorSwatch]( wxCommandEvent& event ) {
142  if ( event.GetId() == ID_CHANGE_LAYER_COLOR ) {
143  aColorSwatch->GetNewSwatchColor();
144  } else {
145  event.Skip();
146  }
147  } );
148 
149  PopupMenu( &menu );
150  passOnFocus();
151 }
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:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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 GERBER_LAYER_WIDGET::onRightDownLayers ( wxMouseEvent &  event)
private

Function OnRightDownLayers puts up a popup menu for the layer panel.

Definition at line 158 of file gerbview_layer_widget.cpp.

References AddRightClickMenuItems(), and LAYER_WIDGET::passOnFocus().

Referenced by GERBER_LAYER_WIDGET().

159 {
160  wxMenu menu;
161 
162  AddRightClickMenuItems( menu );
163  PopupMenu( &menu );
164 
165  passOnFocus();
166 }
void AddRightClickMenuItems(wxMenu &menu)
Function addRightClickMenuItems add menu items to a menu that should be shown when right-clicking the...
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
void LAYER_WIDGET::OnRightDownRender ( wxMouseEvent &  aEvent,
COLOR_SWATCH aColorSwatch,
const wxString &  aRenderName 
)
protectedinherited

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

Definition at line 182 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::getBackgroundLayerColor(), and LAYER_WIDGET::insertRenderRow().

183 {
184  wxMenu menu;
185 
187  _( "Change Render Color for " ) + aRenderName,
188  KiBitmap( setcolor_board_body_xpm ) );
189 
190  menu.Bind( wxEVT_COMMAND_MENU_SELECTED, [this, aColorSwatch]( wxCommandEvent& event ) {
191  if ( event.GetId() == ID_CHANGE_RENDER_COLOR ) {
192  aColorSwatch->GetNewSwatchColor();
193  } else {
194  event.Skip();
195  }
196  } );
197 
198  PopupMenu( &menu );
199  passOnFocus();
200 }
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:174
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Function KiBitmap constructs a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:78
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)
protectedinherited

Definition at line 250 of file layer_widget.cpp.

References LAYER_WIDGET::passOnFocus().

Referenced by LAYER_WIDGET::getBackgroundLayerColor(), and LAYER_WIDGET::LAYER_WIDGET().

251 {
252 // wxFocusEvent event( wxEVT_SET_FOCUS );
253 // m_FocusOwner->AddPendingEvent( event );
254 
255  passOnFocus(); // does not work in this context, probably because we have receive control here too early.
256 }
void passOnFocus()
Function passOnFocus gives away the keyboard focus up to the main parent window.
void GERBER_LAYER_WIDGET::ReFill ( )

Definition at line 244 of file gerbview_layer_widget.cpp.

References LAYER_WIDGET::AppendLayerRow(), LAYER_WIDGET::ClearLayerRows(), GERBER_DRAW_LAYER, GERBER_DRAWLAYERS_COUNT, GERBER_FILE_IMAGE_LIST::GetDisplayName(), EDA_DRAW_FRAME::GetGalCanvas(), GetImagesList(), GERBVIEW_FRAME::GetLayerColor(), GERBVIEW_FRAME::IsLayerVisible(), and myframe.

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

245 {
246  Freeze();
247 
248  ClearLayerRows();
249 
250  for( int layer = 0; layer < GERBER_DRAWLAYERS_COUNT; ++layer )
251  {
252  wxString msg = GetImagesList()->GetDisplayName( layer );
253 
254  bool visible = true;
255  if( auto canvas = myframe->GetGalCanvas() )
256  {
257  visible = canvas->GetView()->IsLayerVisible( GERBER_DRAW_LAYER( layer ) );
258  }
259  else
260  {
261  visible = myframe->IsLayerVisible( layer );
262  }
263 
266  wxEmptyString, visible, true ) );
267  }
268 
269  Thaw();
270 }
Struct ROW provides all the data needed to add a row to a LAYER_WIDGET.
Definition: layer_widget.h:85
const wxString GetDisplayName(int aIdx, bool aNameOnly=false)
GERBVIEW_FRAME * myframe
GERBER_FILE_IMAGE_LIST * GetImagesList()
void ClearLayerRows()
Function ClearLayerRows empties out the layer rows.
#define GERBER_DRAWLAYERS_COUNT
void AppendLayerRow(const ROW &aRow)
Function AppendLayerRow appends a new row in the layer portion of the widget.
bool IsLayerVisible(int aLayer) const
Function IsLayerVisible tests whether a given layer is visible.
COLOR4D GetLayerColor(int aLayer) const
Function GetLayerColor gets a layer color for any valid layer.
EDA_DRAW_PANEL_GAL * GetGalCanvas() const
Function GetGalCanvas returns a pointer to GAL-based canvas of given EDA draw frame.
Definition: draw_frame.h:882
#define GERBER_DRAW_LAYER(x)
void GERBER_LAYER_WIDGET::ReFillRender ( )

Function ReFillRender Rebuild Render for instance after the config is read.

Definition at line 103 of file gerbview_layer_widget.cpp.

References LAYER_WIDGET::AppendRenderRows(), LAYER_WIDGET::ClearRenderRows(), color, LAYER_WIDGET::ROW::color, DARKGRAY, DIM, GERBVIEW_FRAME::GetVisibleElementColor(), GERBVIEW_FRAME::IsElementVisible(), LAYER_DCODES, LAYER_GERBVIEW_GRID, LAYER_NEGATIVE_OBJECTS, myframe, RR, LAYER_WIDGET::ROW::state, and WHITE.

Referenced by GERBER_LAYER_WIDGET(), GERBVIEW_FRAME::GERBVIEW_FRAME(), and GERBVIEW_FRAME::UseGalCanvas().

104 {
105  ClearRenderRows();
106 
107  // Fixed "Rendering" tab rows within the LAYER_WIDGET, only the initial color
108  // is changed before appending to the LAYER_WIDGET. This is an automatic variable
109  // not a static variable, change the color & state after copying from code to renderRows
110  // on the stack.
111  LAYER_WIDGET::ROW renderRows[3] = {
112 
113 #define RR LAYER_WIDGET::ROW // Render Row abreviation to reduce source width
114 
115  // text id color tooltip checked
116  RR( _( "Grid" ), LAYER_GERBVIEW_GRID, WHITE, _( "Show the (x,y) grid dots" ) ),
117  RR( _( "DCodes" ), LAYER_DCODES, WHITE, _( "Show DCodes identification" ) ),
118  RR( _( "Neg. Obj." ), LAYER_NEGATIVE_OBJECTS, DARKGRAY,
119  _( "Show negative objects in this color" ) ),
120  };
121 
122  for( unsigned row=0; row<DIM(renderRows); ++row )
123  {
124  if( renderRows[row].color != COLOR4D::UNSPECIFIED ) // does this row show a color?
125  {
126  renderRows[row].color = myframe->GetVisibleElementColor(
127  ( GERBVIEW_LAYER_ID )renderRows[row].id );
128  }
129  renderRows[row].state = myframe->IsElementVisible(
130  ( GERBVIEW_LAYER_ID )renderRows[row].id );
131  }
132 
133  AppendRenderRows( renderRows, DIM(renderRows) );
134 }
#define DIM(x)
of elements in an array
Definition: macros.h:98
Struct ROW provides all the data needed to add a row to a LAYER_WIDGET.
Definition: layer_widget.h:85
GERBVIEW_FRAME * myframe
int color
Definition: DXF_plotter.cpp:62
#define RR
void ClearRenderRows()
Function ClearRenderRows empties out the render rows.
GERBVIEW_LAYER_ID
GerbView draw layers.
bool state
initial wxCheckBox state
Definition: layer_widget.h:90
COLOR4D color
COLOR4D::UNSPECIFIED if none.
Definition: layer_widget.h:89
COLOR4D GetVisibleElementColor(GERBVIEW_LAYER_ID aItemIdVisible)
Function GetVisibleElementColor returns the color of a gerber visible element.
void AppendRenderRows(const ROW *aRowsArray, int aRowCount)
Function AppendRenderRows appends new rows in the render portion of the widget.
Definition: layer_widget.h:316
bool IsElementVisible(GERBVIEW_LAYER_ID aItemIdVisible) const
Function IsElementVisible tests whether a given element category is visible.
Definition: colors.h:49
void LAYER_WIDGET::SelectLayer ( LAYER_NUM  aLayer)
inherited

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

Definition at line 652 of file layer_widget.cpp.

References LAYER_WIDGET::findLayerRow(), and LAYER_WIDGET::SelectLayerRow().

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

653 {
654  int row = findLayerRow( aLayer );
655  SelectLayerRow( row );
656 }
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)
inherited

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

Definition at line 623 of file layer_widget.cpp.

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

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

624 {
625  // enable the layer tab at index 0
626  m_notebook->SetSelection( 0 );
627 
628  INDICATOR_ICON* oldIndicator = (INDICATOR_ICON*) getLayerComp( m_CurrentRow, 0 );
629  if( oldIndicator )
631 
632  INDICATOR_ICON* newIndicator = (INDICATOR_ICON*) getLayerComp( aRow, 0 );
633  if( newIndicator )
634  {
636 
637  // Make sure the desired layer row is visible.
638  // It seems that as of 2.8.2, setting the focus does this.
639  // I don't expect the scrolling to be needed at all because
640  // the minimum window size may end up being established so that the
641  // scroll bars will not be visible.
642  getLayerComp( aRow, 1 )->SetFocus();
643  }
644 
645  m_CurrentRow = aRow;
646 
647  // give the focus back to the app.
648  passOnFocus();
649 }
void SetIndicatorState(ICON_ID aIconId)
Sets the row indiciator to the given state.
wxAuiNotebook * m_notebook
Definition: layer_widget.h:110
int m_CurrentRow
selected row of layer list
Definition: layer_widget.h:119
#define OFF
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::SetLayerColor ( LAYER_NUM  aLayer,
COLOR4D  aColor 
)
inherited

Function SetLayerColor changes the color of aLayer.

Definition at line 694 of file layer_widget.cpp.

References LAYER_WIDGET::findLayerRow(), and LAYER_WIDGET::getLayerComp().

Referenced by LAYER_WIDGET::AppendRenderRows().

695 {
696  int row = findLayerRow( aLayer );
697  if( row >= 0 )
698  {
699  int col = 1; // bitmap button is column 1
700  auto swatch = static_cast<COLOR_SWATCH*>( getLayerComp( row, col ) );
701  wxASSERT( swatch );
702 
703  swatch->SetSwatchColor( aColor, false );
704  }
705 }
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 GERBER_LAYER_WIDGET::SetLayersManagerTabsText ( )

Function SetLayersManagerTabsText Update the layer manager tabs labels Useful when changing Language or to set labels to a non default value.

Definition at line 93 of file gerbview_layer_widget.cpp.

References LAYER_WIDGET::m_notebook.

Referenced by GERBER_LAYER_WIDGET(), and GERBVIEW_FRAME::ShowChangedLanguage().

94 {
95  m_notebook->SetPageText(0, _("Layer") );
96  m_notebook->SetPageText(1, _("Render") );
97 }
wxAuiNotebook * m_notebook
Definition: layer_widget.h:110
void LAYER_WIDGET::SetLayerVisible ( LAYER_NUM  aLayer,
bool  isVisible 
)
inherited

Function SetLayerVisible sets aLayer visible or not.

This does not invoke OnLayerVisible().

Definition at line 669 of file layer_widget.cpp.

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

Referenced by LAYER_WIDGET::AppendRenderRows(), and PCB_LAYER_WIDGET::SyncLayerVisibilities().

670 {
671  int row = findLayerRow( aLayer );
672  if( row >= 0 )
673  {
674  wxCheckBox* cb = (wxCheckBox*) getLayerComp( row, COLUMN_COLOR_LYR_CB );
675  wxASSERT( cb );
676  cb->SetValue( isVisible ); // does not fire an event
677  }
678 }
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:53
void LAYER_WIDGET::SetRenderState ( int  aId,
bool  isSet 
)
inherited

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 724 of file layer_widget.cpp.

References LAYER_WIDGET::findRenderRow(), and LAYER_WIDGET::getRenderComp().

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

725 {
726  int row = findRenderRow( aId );
727 
728  if( row >= 0 )
729  {
730  int col = 1; // checkbox is column 1
731  wxCheckBox* cb = (wxCheckBox*) getRenderComp( row, col );
732  wxASSERT( cb );
733  cb->SetValue( isSet ); // does not fire an event
734  }
735 }
int findRenderRow(int aId) const
wxWindow * getRenderComp(int aRow, int aColumn) const
void LAYER_WIDGET::UpdateLayerIcons ( )
inherited

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 764 of file layer_widget.cpp.

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

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

765 {
766  int rowCount = GetLayerRowCount();
767 
768  for( int row = 0; row < rowCount ; row++ )
769  {
771 
772  if( indicator )
773  {
774  auto state = ( row == m_CurrentRow ) ? ROW_ICON_PROVIDER::STATE::ON
776  indicator->SetIndicatorState( state );
777  }
778  }
779 }
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:119
#define OFF
Class representing a row indicator icon for use in places like the layer widget.
#define COLUMN_ICON_ACTIVE
Definition: layer_widget.h:51
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.
#define ON
void LAYER_WIDGET::UpdateLayouts ( )
inherited

Definition at line 754 of file layer_widget.cpp.

References LAYER_WIDGET::m_LayerPanel, LAYER_WIDGET::m_LayersFlexGridSizer, LAYER_WIDGET::m_RenderFlexGridSizer, and LAYER_WIDGET::m_RenderingPanel.

Referenced by LAYER_WIDGET::AppendLayerRow(), LAYER_WIDGET::AppendRenderRow(), and LAYER_WIDGET::AppendRenderRows().

755 {
756  m_LayersFlexGridSizer->Layout();
757  m_RenderFlexGridSizer->Layout();
758  m_LayerPanel->Layout();
759  m_RenderingPanel->Layout();
760  FitInside();
761 }
wxFlexGridSizer * m_LayersFlexGridSizer
Definition: layer_widget.h:113
wxFlexGridSizer * m_RenderFlexGridSizer
Definition: layer_widget.h:116
wxPanel * m_RenderingPanel
Definition: layer_widget.h:114
wxPanel * m_LayerPanel
Definition: layer_widget.h:111
bool GERBER_LAYER_WIDGET::useAlternateBitmap ( int  aRow)
overrideprivatevirtual

Virtual Function useAlternateBitmap.

Returns
true if bitmaps shown in Render layer list are alternate bitmaps, or false if they are "normal" bitmaps

Reimplemented from LAYER_WIDGET.

Definition at line 382 of file gerbview_layer_widget.cpp.

References GERBER_FILE_IMAGE_LIST::GetGbrImage(), and GetImagesList().

383 {
384  return GetImagesList()->GetGbrImage( aRow ) != NULL;
385 }
GERBER_FILE_IMAGE_LIST * GetImagesList()
GERBER_FILE_IMAGE * GetGbrImage(int aIdx)

Member Data Documentation

const wxEventType LAYER_WIDGET::EVT_LAYER_COLOR_CHANGE = wxNewEventType()
staticinherited

Definition at line 106 of file layer_widget.h.

Referenced by LAYER_WIDGET::OnLayerSwatchChanged().

bool GERBER_LAYER_WIDGET::m_alwaysShowActiveLayer
private

Definition at line 45 of file gerbview_layer_widget.h.

Referenced by GERBER_LAYER_WIDGET(), OnLayerSelected(), and onPopupSelection().

int LAYER_WIDGET::m_CurrentRow
protectedinherited
wxWindow* LAYER_WIDGET::m_FocusOwner
protectedinherited

Definition at line 118 of file layer_widget.h.

Referenced by LAYER_WIDGET::LAYER_WIDGET(), and LAYER_WIDGET::passOnFocus().

wxPanel* LAYER_WIDGET::m_LayerPanel
protectedinherited
wxScrolledWindow* LAYER_WIDGET::m_LayerScrolledWindow
protectedinherited
wxAuiNotebook* LAYER_WIDGET::m_notebook
protectedinherited
int LAYER_WIDGET::m_PointSize
protectedinherited
wxPanel* LAYER_WIDGET::m_RenderingPanel
protectedinherited
wxScrolledWindow* LAYER_WIDGET::m_RenderScrolledWindow
protectedinherited

Definition at line 115 of file layer_widget.h.

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


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