2018-04-28 15:22:25 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2023-05-11 10:42:53 +00:00
|
|
|
* Copyright (C) 2018-2023 KiCad Developers, see change_log.txt for contributors.
|
2018-04-28 15:22:25 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef PANEL_SETUP_LAYERS_H
|
|
|
|
#define PANEL_SETUP_LAYERS_H
|
|
|
|
|
|
|
|
#include <widgets/unit_binder.h>
|
|
|
|
#include <widgets/paged_dialog.h>
|
|
|
|
#include <panel_setup_layers_base.h>
|
|
|
|
|
|
|
|
class PCB_EDIT_FRAME;
|
|
|
|
class BOARD;
|
|
|
|
class BOARD_DESIGN_SETTINGS;
|
2021-02-24 02:31:12 +00:00
|
|
|
class PANEL_SETUP_BOARD_STACKUP;
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-01-27 22:15:38 +00:00
|
|
|
* The 3 UI control pointers for a single board layer.
|
2018-04-28 15:22:25 +00:00
|
|
|
*/
|
|
|
|
struct PANEL_SETUP_LAYERS_CTLs
|
|
|
|
{
|
|
|
|
PANEL_SETUP_LAYERS_CTLs( wxControl* aName, wxCheckBox* aCheckBox, wxControl* aChoiceOrDesc )
|
|
|
|
{
|
|
|
|
name = aName;
|
|
|
|
checkbox = aCheckBox;
|
|
|
|
choice = aChoiceOrDesc;
|
|
|
|
}
|
|
|
|
|
|
|
|
wxControl* name;
|
|
|
|
wxCheckBox* checkbox;
|
|
|
|
wxControl* choice;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class PANEL_SETUP_LAYERS : public PANEL_SETUP_LAYERS_BASE
|
|
|
|
{
|
|
|
|
public:
|
2023-05-11 10:42:53 +00:00
|
|
|
PANEL_SETUP_LAYERS( wxWindow* aParentWindow, PCB_EDIT_FRAME* aFrame );
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
void ImportSettingsFrom( BOARD* aBoard );
|
|
|
|
|
2020-08-07 17:08:45 +00:00
|
|
|
/**
|
|
|
|
* Check and warn if inner copper layers will be deleted
|
|
|
|
*
|
|
|
|
* This function warns users if they are going to delete inner copper layers because
|
|
|
|
* they're importing settings from a board with less copper layers than the board
|
|
|
|
* already loaded.
|
|
|
|
*
|
2021-01-27 22:15:38 +00:00
|
|
|
* @param aWorkingBoard is the currently loaded PCB
|
|
|
|
* @param aImportedBoard is the PCB imported to get settings from.
|
|
|
|
* @return Approval to delete inner copper if needed.
|
2020-08-07 17:08:45 +00:00
|
|
|
*/
|
2020-09-20 12:42:43 +00:00
|
|
|
bool CheckCopperLayerCount( BOARD* aWorkingBoard, BOARD* aImportedBoard );
|
2020-08-07 17:08:45 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @return the selected layer mask within the UI checkboxes
|
2019-07-27 19:09:43 +00:00
|
|
|
LSET GetUILayerMask();
|
2020-08-07 17:08:45 +00:00
|
|
|
|
2021-01-27 22:15:38 +00:00
|
|
|
///< @return the layer name within the UI wxTextCtrl
|
2021-07-21 23:14:56 +00:00
|
|
|
wxString GetLayerName( int layer );
|
2019-07-27 19:09:43 +00:00
|
|
|
|
2021-02-24 02:31:12 +00:00
|
|
|
/**
|
|
|
|
* Called when switching to this tab to make sure that any changes to the copper layer count
|
|
|
|
* made on the physical stackup page are reflected here
|
|
|
|
* @param aNumCopperLayers is the number of copper layers in the board
|
|
|
|
*/
|
|
|
|
void SyncCopperLayers( int aNumCopperLayers );
|
|
|
|
|
|
|
|
void SetPhysicalStackupPanel( PANEL_SETUP_BOARD_STACKUP* aPanel )
|
|
|
|
{
|
|
|
|
m_physicalStackup = aPanel;
|
|
|
|
}
|
2018-04-28 15:22:25 +00:00
|
|
|
|
2023-01-12 14:16:11 +00:00
|
|
|
bool IsInitialized() const { return m_initialized; }
|
|
|
|
|
2021-02-24 02:31:12 +00:00
|
|
|
private:
|
2021-07-21 23:14:56 +00:00
|
|
|
void setLayerCheckBox( int layer, bool isChecked );
|
2018-04-28 15:22:25 +00:00
|
|
|
void setCopperLayerCheckBoxes( int copperCount );
|
|
|
|
void setMandatoryLayerCheckBoxes();
|
2020-09-22 21:50:59 +00:00
|
|
|
void setUserDefinedLayerCheckBoxes();
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
void showBoardLayerNames();
|
|
|
|
void showSelectedLayerCheckBoxes( LSET enableLayerMask );
|
|
|
|
void showLayerTypes();
|
|
|
|
|
2021-07-21 23:14:56 +00:00
|
|
|
int getLayerTypeIndex( int layer );
|
2018-04-28 15:22:25 +00:00
|
|
|
|
|
|
|
void OnCheckBox( wxCommandEvent& event ) override;
|
|
|
|
void DenyChangeCheckBox( wxCommandEvent& event ) override;
|
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
2020-09-22 21:50:59 +00:00
|
|
|
virtual void addUserDefinedLayer( wxCommandEvent& aEvent ) override;
|
|
|
|
|
2018-04-28 15:22:25 +00:00
|
|
|
bool testLayerNames();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a list of layers removed from the board that contain items.
|
2024-02-20 17:38:33 +00:00
|
|
|
* Footprints and items owned by footprints are not taken in account
|
2018-04-28 15:22:25 +00:00
|
|
|
*/
|
|
|
|
LSEQ getRemovedLayersWithItems();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a list of layers in use in footprints, and therefore not removable.
|
|
|
|
*/
|
|
|
|
LSEQ getNonRemovableLayers();
|
|
|
|
|
2021-07-21 23:14:56 +00:00
|
|
|
PANEL_SETUP_LAYERS_CTLs getCTLs( int aLayerNumber );
|
|
|
|
wxControl* getName( int aLayer );
|
|
|
|
wxCheckBox* getCheckBox( int aLayer );
|
|
|
|
wxChoice* getChoice( int aLayer );
|
2021-02-24 02:31:12 +00:00
|
|
|
|
2023-05-11 10:42:53 +00:00
|
|
|
private:
|
2021-02-24 02:31:12 +00:00
|
|
|
PCB_EDIT_FRAME* m_frame;
|
|
|
|
PANEL_SETUP_BOARD_STACKUP* m_physicalStackup;
|
|
|
|
BOARD* m_pcb;
|
|
|
|
LSET m_enabledLayers;
|
2023-01-12 14:16:11 +00:00
|
|
|
bool m_initialized;
|
2018-04-28 15:22:25 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif //PANEL_SETUP_LAYERS_H
|
|
|
|
|
|
|
|
|