2016-04-06 18:15:49 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
2018-01-13 16:05:09 +00:00
|
|
|
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2016-04-06 18:15:49 +00:00
|
|
|
* Copyright (C) 2013 Dick Hollenbeck, dick@softplc.com
|
2021-06-04 16:21:48 +00:00
|
|
|
* Copyright (C) 2008-2013 Wayne Stambaugh <stambaughw@gmail.com>
|
2023-04-03 13:27:36 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2016-04-06 18:15:49 +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 _DIALOG_PAD_PROPERTIES_H_
|
|
|
|
#define _DIALOG_PAD_PROPERTIES_H_
|
|
|
|
|
2018-01-29 15:39:40 +00:00
|
|
|
#include <pcb_base_frame.h>
|
2016-04-10 22:14:28 +00:00
|
|
|
#include <wx/valnum.h>
|
2020-11-12 20:19:22 +00:00
|
|
|
#include <board.h>
|
|
|
|
#include <footprint.h>
|
2021-06-06 19:03:10 +00:00
|
|
|
#include <pad_shapes.h>
|
2020-10-04 23:34:59 +00:00
|
|
|
#include <pcb_shape.h>
|
2016-04-06 18:15:49 +00:00
|
|
|
#include <origin_viewitem.h>
|
|
|
|
#include <dialog_pad_properties_base.h>
|
2017-11-23 13:05:26 +00:00
|
|
|
#include <widgets/text_ctrl_eval.h>
|
2017-01-02 06:13:45 +00:00
|
|
|
#include <pcb_draw_panel_gal.h>
|
2018-05-23 06:11:47 +00:00
|
|
|
#include <widgets/unit_binder.h>
|
2016-04-06 18:15:49 +00:00
|
|
|
|
|
|
|
/**
|
2020-01-10 14:31:00 +00:00
|
|
|
* DIALOG_PAD_PROPERTIES, derived from DIALOG_PAD_PROPERTIES_BASE,
|
2016-04-06 18:15:49 +00:00
|
|
|
* created by wxFormBuilder
|
|
|
|
*/
|
2020-12-31 09:53:14 +00:00
|
|
|
// The wxWidgets window name. Used to retrieve the dialog by window name
|
2022-02-04 22:44:59 +00:00
|
|
|
#define PAD_PROPERTIES_DLG_NAME wxT( "pad_properties_dlg_name" )
|
2020-12-31 09:53:14 +00:00
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
class DIALOG_PAD_PROPERTIES : public DIALOG_PAD_PROPERTIES_BASE
|
|
|
|
{
|
|
|
|
public:
|
2020-11-12 22:30:02 +00:00
|
|
|
DIALOG_PAD_PROPERTIES( PCB_BASE_FRAME* aParent, PAD* aPad );
|
2018-08-19 16:11:58 +00:00
|
|
|
~DIALOG_PAD_PROPERTIES();
|
2016-04-06 18:15:49 +00:00
|
|
|
|
|
|
|
private:
|
2017-01-13 17:51:22 +00:00
|
|
|
void prepareCanvas(); // Initialize the canvases (legacy or gal) to display the pad
|
2016-04-06 18:15:49 +00:00
|
|
|
void initValues();
|
2017-01-13 17:51:22 +00:00
|
|
|
bool padValuesOK(); ///< test if all values are acceptable for the pad
|
2016-04-06 18:15:49 +00:00
|
|
|
void redraw();
|
|
|
|
void updateRoundRectCornerValues();
|
|
|
|
|
|
|
|
/**
|
2021-06-04 16:21:48 +00:00
|
|
|
* Updates the CheckBox states in pad layers list, based on the layer_mask (if non-empty)
|
|
|
|
* or the default layers for the current pad type.
|
2016-04-06 18:15:49 +00:00
|
|
|
*/
|
2020-11-05 11:49:05 +00:00
|
|
|
void updatePadLayersList( LSET layer_mask, bool remove_unconnected, bool keep_top_bottom );
|
2016-04-06 18:15:49 +00:00
|
|
|
|
|
|
|
/// Copy values from dialog field to aPad's members
|
2020-11-12 22:30:02 +00:00
|
|
|
bool transferDataToPad( PAD* aPad );
|
2016-04-06 18:15:49 +00:00
|
|
|
|
2020-09-06 21:38:00 +00:00
|
|
|
bool Show( bool aShow ) override;
|
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
// event handlers:
|
2017-01-13 17:51:22 +00:00
|
|
|
void OnInitDialog( wxInitDialogEvent& event ) override;
|
2016-04-06 18:15:49 +00:00
|
|
|
void OnResize( wxSizeEvent& event );
|
2017-11-07 17:33:13 +00:00
|
|
|
void OnCancel( wxCommandEvent& event ) override;
|
2019-06-21 16:57:02 +00:00
|
|
|
void OnUpdateUI( wxUpdateUIEvent& event ) override;
|
2023-05-12 21:03:54 +00:00
|
|
|
void onTeardropsUpdateUi( wxUpdateUIEvent& event ) override;
|
|
|
|
void onTeardropCurvePointsUpdateUi( wxUpdateUIEvent& event ) override;
|
2016-04-06 18:15:49 +00:00
|
|
|
|
2021-06-06 19:03:10 +00:00
|
|
|
void OnUpdateUINonCopperWarning( wxUpdateUIEvent& event ) override;
|
2018-05-02 08:31:10 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnPadShapeSelection( wxCommandEvent& event ) override;
|
|
|
|
void OnDrillShapeSelected( wxCommandEvent& event ) override;
|
2018-01-13 16:05:09 +00:00
|
|
|
void onChangePadMode( wxCommandEvent& event ) override;
|
2020-06-01 16:05:40 +00:00
|
|
|
void OnOffsetCheckbox( wxCommandEvent& event ) override;
|
|
|
|
void OnPadToDieCheckbox( wxCommandEvent& event ) override;
|
2016-04-06 18:15:49 +00:00
|
|
|
|
2016-09-24 18:53:15 +00:00
|
|
|
void PadOrientEvent( wxCommandEvent& event ) override;
|
|
|
|
void PadTypeSelected( wxCommandEvent& event ) override;
|
2016-04-06 18:15:49 +00:00
|
|
|
|
2020-08-23 17:11:47 +00:00
|
|
|
void UpdateLayersDropdown();
|
|
|
|
void OnSetCopperLayers( wxCommandEvent& event ) override;
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnSetLayers( wxCommandEvent& event ) override;
|
2016-04-06 18:15:49 +00:00
|
|
|
|
|
|
|
// Called when corner setup value is changed for rounded rect pads
|
2016-09-24 18:53:15 +00:00
|
|
|
void onCornerSizePercentChange( wxCommandEvent& event ) override;
|
2018-09-09 19:19:21 +00:00
|
|
|
void onCornerRadiusChange( wxCommandEvent& event ) override;
|
2016-04-06 18:15:49 +00:00
|
|
|
|
|
|
|
/// Called when a dimension has changed.
|
|
|
|
/// Update the graphical pad shown in the panel.
|
2016-09-24 18:53:15 +00:00
|
|
|
void OnValuesChanged( wxCommandEvent& event ) override;
|
2016-04-06 18:15:49 +00:00
|
|
|
|
|
|
|
/// Updates the different parameters for the component being edited.
|
2016-04-10 10:40:31 +00:00
|
|
|
/// Automatically fired from the OK button click.
|
2017-01-13 17:51:22 +00:00
|
|
|
|
|
|
|
bool TransferDataFromWindow() override;
|
|
|
|
bool TransferDataToWindow() override;
|
|
|
|
|
2019-12-11 10:36:45 +00:00
|
|
|
/// Return the pad property currently selected
|
2021-05-01 14:58:30 +00:00
|
|
|
PAD_PROP getSelectedProperty();
|
2021-06-04 16:21:48 +00:00
|
|
|
|
2023-04-03 13:27:36 +00:00
|
|
|
// Show/hide the hole size Y widgets
|
|
|
|
// Setting the X/Diameter label according to the selected hole type
|
|
|
|
void updateHoleControls();
|
|
|
|
|
|
|
|
// Show/hide the pad size Y widgets
|
|
|
|
// Setting the X/Diameter label according to the selected hole type
|
|
|
|
void updatePadSizeControls();
|
|
|
|
|
2021-06-04 16:21:48 +00:00
|
|
|
private:
|
|
|
|
PCB_BASE_FRAME* m_parent;
|
2023-04-03 13:27:36 +00:00
|
|
|
PAD* m_currentPad; // pad currently being edited
|
|
|
|
PAD* m_previewPad; // a working copy used to show changes
|
|
|
|
PAD* m_masterPad; // pad used to create new pads in board or FP editor
|
|
|
|
BOARD* m_board; // the main board: this is the board handled by the PCB
|
|
|
|
// editor or the dummy board used by the FP editor
|
|
|
|
bool m_canUpdate;
|
|
|
|
bool m_canEditNetName; // true only if the caller is the board editor
|
|
|
|
bool m_isFpEditor; // true if the caller is the footprint editor
|
2021-06-04 16:21:48 +00:00
|
|
|
|
|
|
|
std::vector<std::shared_ptr<PCB_SHAPE>> m_primitives; // the custom shape primitives in
|
|
|
|
// local coords, orient 0
|
|
|
|
// must define a single copper area
|
2023-04-03 13:27:36 +00:00
|
|
|
COLOR4D m_selectedColor; // color used to draw selected primitives when
|
|
|
|
// editing a custom pad shape
|
2021-06-04 16:21:48 +00:00
|
|
|
|
2023-04-03 13:27:36 +00:00
|
|
|
std::vector<PCB_SHAPE*> m_highlight; // shapes highlighted in GAL mode
|
|
|
|
PCB_DRAW_PANEL_GAL* m_padPreviewGAL;
|
|
|
|
KIGFX::ORIGIN_VIEWITEM* m_axisOrigin; // origin of the preview canvas
|
2023-10-23 13:13:15 +00:00
|
|
|
|
2023-04-03 13:27:36 +00:00
|
|
|
static bool m_sketchPreview; // session storage
|
2023-10-23 13:13:15 +00:00
|
|
|
static int m_page; // remember the last open page during session
|
|
|
|
|
2021-06-04 16:21:48 +00:00
|
|
|
|
|
|
|
UNIT_BINDER m_posX, m_posY;
|
|
|
|
UNIT_BINDER m_sizeX, m_sizeY;
|
|
|
|
UNIT_BINDER m_offsetX, m_offsetY;
|
|
|
|
UNIT_BINDER m_padToDie;
|
|
|
|
UNIT_BINDER m_trapDelta;
|
2021-08-07 18:29:49 +00:00
|
|
|
UNIT_BINDER m_cornerRadius;
|
|
|
|
UNIT_BINDER m_cornerRatio;
|
2021-08-06 14:26:08 +00:00
|
|
|
UNIT_BINDER m_chamferRatio;
|
2021-08-08 13:37:14 +00:00
|
|
|
UNIT_BINDER m_mixedCornerRatio;
|
|
|
|
UNIT_BINDER m_mixedChamferRatio;
|
2021-06-04 16:21:48 +00:00
|
|
|
UNIT_BINDER m_holeX, m_holeY;
|
|
|
|
UNIT_BINDER m_clearance;
|
2021-08-06 14:26:08 +00:00
|
|
|
UNIT_BINDER m_maskMargin;
|
2021-08-08 13:37:14 +00:00
|
|
|
UNIT_BINDER m_pasteMargin;
|
|
|
|
UNIT_BINDER m_pasteMarginRatio;
|
|
|
|
UNIT_BINDER m_thermalGap;
|
|
|
|
UNIT_BINDER m_spokeWidth;
|
|
|
|
UNIT_BINDER m_spokeAngle;
|
2021-10-30 09:56:24 +00:00
|
|
|
UNIT_BINDER m_pad_orientation;
|
2023-05-12 21:03:54 +00:00
|
|
|
UNIT_BINDER m_teardropMaxLenSetting;
|
|
|
|
UNIT_BINDER m_teardropMaxHeightSetting;
|
2017-01-13 17:51:22 +00:00
|
|
|
};
|
|
|
|
|
2016-04-06 18:15:49 +00:00
|
|
|
|
|
|
|
#endif // #ifndef _DIALOG_PAD_PROPERTIES_H_
|