2014-10-27 14:14:39 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2015-02-02 16:43:34 +00:00
|
|
|
* Copyright (C) 2010-2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
|
2022-10-11 23:38:01 +00:00
|
|
|
* Copyright (C) 1992-2022 KiCad Developers, see AUTHORS.txt for contributors.
|
2014-10-27 14:14:39 +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
|
|
|
|
*/
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2021-04-04 09:41:48 +00:00
|
|
|
#ifndef DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_H
|
|
|
|
#define DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_H
|
2009-08-11 10:27:21 +00:00
|
|
|
|
|
|
|
#include <vector>
|
2021-02-02 23:16:37 +00:00
|
|
|
#include <fp_text_grid_table.h>
|
2018-03-28 17:14:04 +00:00
|
|
|
#include <widgets/unit_binder.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <footprint.h>
|
2021-04-04 09:41:48 +00:00
|
|
|
#include <dialog_footprint_properties_fp_editor_base.h>
|
2018-09-13 15:39:14 +00:00
|
|
|
|
2015-12-08 07:31:57 +00:00
|
|
|
|
2018-09-13 15:39:14 +00:00
|
|
|
class FOOTPRINT_EDIT_FRAME;
|
2021-07-28 19:22:57 +00:00
|
|
|
class PANEL_FP_PROPERTIES_3D_MODEL;
|
2018-09-13 15:39:14 +00:00
|
|
|
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2021-12-05 21:56:55 +00:00
|
|
|
class PRIVATE_LAYERS_GRID_TABLE : public wxGridTableBase, public std::vector<PCB_LAYER_ID>
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
PRIVATE_LAYERS_GRID_TABLE( PCB_BASE_FRAME* aFrame );
|
|
|
|
~PRIVATE_LAYERS_GRID_TABLE();
|
|
|
|
|
|
|
|
int GetNumberRows() override { return (int) size(); }
|
|
|
|
int GetNumberCols() override { return 1; }
|
|
|
|
|
|
|
|
bool CanGetValueAs( int aRow, int aCol, const wxString& aTypeName ) override;
|
|
|
|
bool CanSetValueAs( int aRow, int aCol, const wxString& aTypeName ) override;
|
|
|
|
wxGridCellAttr* GetAttr( int row, int col, wxGridCellAttr::wxAttrKind kind ) override;
|
|
|
|
|
|
|
|
wxString GetValue( int aRow, int aCol ) override;
|
|
|
|
long GetValueAsLong( int aRow, int aCol ) override;
|
|
|
|
|
|
|
|
void SetValue( int aRow, int aCol, const wxString& aValue ) override;
|
|
|
|
void SetValueAsLong( int aRow, int aCol, long aValue ) override;
|
|
|
|
|
|
|
|
private:
|
|
|
|
PCB_BASE_FRAME* m_frame;
|
|
|
|
wxGridCellAttr* m_layerColAttr;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-07-28 19:22:57 +00:00
|
|
|
enum class NOTEBOOK_PAGES
|
2021-07-28 15:40:35 +00:00
|
|
|
{
|
2021-07-28 19:22:57 +00:00
|
|
|
PAGE_UNKNOWN = -1,
|
|
|
|
PAGE_GENERAL = 0,
|
|
|
|
PAGE_CLEARANCES = 1,
|
|
|
|
PAGE_3D_MODELS = 2
|
2021-07-28 15:40:35 +00:00
|
|
|
};
|
|
|
|
|
2021-04-04 09:41:48 +00:00
|
|
|
class DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR : public DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_BASE
|
2009-08-11 10:27:21 +00:00
|
|
|
{
|
|
|
|
public:
|
2021-04-04 09:41:48 +00:00
|
|
|
DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR( FOOTPRINT_EDIT_FRAME* aParent, FOOTPRINT* aFootprint );
|
|
|
|
~DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR() override;
|
2009-08-11 10:27:21 +00:00
|
|
|
|
2018-03-28 17:14:04 +00:00
|
|
|
bool Validate() override;
|
2014-08-24 07:05:07 +00:00
|
|
|
|
2018-03-28 17:14:04 +00:00
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
bool TransferDataFromWindow() override;
|
2017-04-16 11:53:56 +00:00
|
|
|
|
2018-03-28 17:14:04 +00:00
|
|
|
private:
|
|
|
|
// virtual event functions
|
|
|
|
void OnGridSize( wxSizeEvent& event ) override;
|
2018-09-13 15:39:14 +00:00
|
|
|
void OnFootprintNameText( wxCommandEvent& event ) override;
|
2018-03-28 17:14:04 +00:00
|
|
|
void OnAddField( wxCommandEvent& event ) override;
|
|
|
|
void OnDeleteField( wxCommandEvent& event ) override;
|
2021-12-05 21:56:55 +00:00
|
|
|
void OnAddLayer( wxCommandEvent& event ) override;
|
|
|
|
void OnDeleteLayer( wxCommandEvent& event ) override;
|
2022-08-19 17:34:53 +00:00
|
|
|
void OnAddPadGroup( wxCommandEvent& event ) override;
|
|
|
|
void OnRemovePadGroup( wxCommandEvent& event ) override;
|
2018-03-28 17:14:04 +00:00
|
|
|
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
2016-07-02 12:44:36 +00:00
|
|
|
|
2018-09-13 15:39:14 +00:00
|
|
|
bool checkFootprintName( const wxString& aFootprintName );
|
|
|
|
|
2021-12-16 14:39:58 +00:00
|
|
|
void adjustGridColumns();
|
2021-06-04 16:21:48 +00:00
|
|
|
|
2021-06-19 17:28:45 +00:00
|
|
|
private:
|
2021-12-05 21:56:55 +00:00
|
|
|
FOOTPRINT_EDIT_FRAME* m_frame;
|
|
|
|
FOOTPRINT* m_footprint;
|
2021-06-04 16:21:48 +00:00
|
|
|
|
2021-12-05 21:56:55 +00:00
|
|
|
static NOTEBOOK_PAGES m_page; // remember the last open page during session
|
2021-06-04 16:21:48 +00:00
|
|
|
|
2023-05-24 12:39:25 +00:00
|
|
|
FP_TEXT_GRID_TABLE* m_fields;
|
2021-12-05 21:56:55 +00:00
|
|
|
PRIVATE_LAYERS_GRID_TABLE* m_privateLayers;
|
2021-06-04 16:21:48 +00:00
|
|
|
|
2021-12-05 21:56:55 +00:00
|
|
|
UNIT_BINDER m_netClearance;
|
|
|
|
UNIT_BINDER m_solderMask;
|
|
|
|
UNIT_BINDER m_solderPaste;
|
|
|
|
UNIT_BINDER m_solderPasteRatio;
|
2021-06-04 16:21:48 +00:00
|
|
|
|
2021-12-05 21:56:55 +00:00
|
|
|
wxControl* m_delayedFocusCtrl;
|
|
|
|
NOTEBOOK_PAGES m_delayedFocusPage;
|
2021-06-04 16:21:48 +00:00
|
|
|
|
2021-12-05 21:56:55 +00:00
|
|
|
WX_GRID* m_delayedFocusGrid;
|
|
|
|
int m_delayedFocusRow;
|
|
|
|
int m_delayedFocusColumn;
|
|
|
|
wxString m_delayedErrorMessage;
|
2021-06-04 16:21:48 +00:00
|
|
|
|
2021-07-28 19:22:57 +00:00
|
|
|
PANEL_FP_PROPERTIES_3D_MODEL* m_3dPanel;
|
2022-10-11 23:38:01 +00:00
|
|
|
|
|
|
|
wxSize m_gridSize;
|
|
|
|
wxSize m_lastRequestedSize;
|
2009-08-11 10:27:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2021-04-04 09:41:48 +00:00
|
|
|
#endif // DIALOG_FOOTPRINT_PROPERTIES_FP_EDITOR_H
|