1 /* 2 * This program source code file is part of KiCad, a free EDA CAD application. 3 * 4 * Copyright (C) 2010-2015 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr 5 * Copyright (C) 1992-2021 KiCad Developers, see AUTHORS.txt for contributors. 6 * 7 * This program is free software; you can redistribute it and/or 8 * modify it under the terms of the GNU General Public License 9 * as published by the Free Software Foundation; either version 2 10 * of the License, or (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program; if not, you may find one here: 19 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html 20 * or you may search the http://www.gnu.org website for the version 2 license, 21 * or you may write to the Free Software Foundation, Inc., 22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 23 */ 24 25 26 #ifndef DIALOG_FOOTPRINT_PROPERTIES_H 27 #define DIALOG_FOOTPRINT_PROPERTIES_H 28 29 30 #include <dialog_footprint_properties_base.h> 31 #include <wx/valnum.h> 32 #include <fp_text_grid_table.h> 33 #include <footprint.h> 34 #include <widgets/unit_binder.h> 35 36 37 class PCB_EDIT_FRAME; 38 class PANEL_FP_PROPERTIES_3D_MODEL; 39 40 class DIALOG_FOOTPRINT_PROPERTIES: public DIALOG_FOOTPRINT_PROPERTIES_BASE 41 { 42 public: 43 // The dialog can be closed for several reasons. 44 enum FP_PROPS_RETVALUE 45 { 46 FP_PROPS_CANCEL, 47 FP_PROPS_UPDATE_FP, 48 FP_PROPS_CHANGE_FP, 49 FP_PROPS_OK, 50 FP_PROPS_EDIT_BOARD_FP, 51 FP_PROPS_EDIT_LIBRARY_FP 52 }; 53 54 DIALOG_FOOTPRINT_PROPERTIES( PCB_EDIT_FRAME* aParent, FOOTPRINT* aFootprint ); 55 ~DIALOG_FOOTPRINT_PROPERTIES() override; 56 57 bool Validate() override; 58 59 bool TransferDataToWindow() override; 60 bool TransferDataFromWindow() override; 61 62 ///< @return the value depending on the way the dialog was closed. GetReturnValue()63 enum FP_PROPS_RETVALUE GetReturnValue() { return m_returnValue; } 64 65 private: 66 // virtual event functions 67 void EditFootprint( wxCommandEvent& ) override; 68 void EditLibraryFootprint( wxCommandEvent& ) override; 69 void UpdateFootprint( wxCommandEvent& ) override; 70 void ChangeFootprint( wxCommandEvent& ) override; 71 void FootprintOrientEvent( wxCommandEvent& ) override; 72 void OnOtherOrientation( wxCommandEvent& aEvent ) override; 73 void OnGridSize( wxSizeEvent& aEvent ) override; 74 void OnAddField( wxCommandEvent& ) override; 75 void OnDeleteField( wxCommandEvent& ) override; 76 void OnUpdateUI( wxUpdateUIEvent& ) override; 77 void OnPageChange( wxNotebookEvent& event ) override; 78 79 void select3DModel( int aModelIdx ); 80 81 void adjustGridColumns( int aWidth ); 82 83 /** 84 * Update the orientation validated control, without triggering a change 85 * event on the control (which would update the radio buttons) 86 */ 87 void updateOrientationControl(); 88 89 private: 90 PCB_EDIT_FRAME* m_frame; 91 FOOTPRINT* m_footprint; 92 93 static int m_page; // remember the last open page during session 94 95 FP_TEXT_GRID_TABLE* m_texts; 96 UNIT_BINDER m_posX; 97 UNIT_BINDER m_posY; 98 wxFloatingPointValidator<double> m_orientValidator; 99 double m_orientValue; 100 101 UNIT_BINDER m_netClearance; 102 UNIT_BINDER m_solderMask; 103 UNIT_BINDER m_solderPaste; 104 UNIT_BINDER m_solderPasteRatio; 105 106 wxString m_delayedErrorMessage; 107 wxGrid* m_delayedFocusGrid; 108 int m_delayedFocusRow; 109 int m_delayedFocusColumn; 110 bool m_initialFocus; 111 112 std::vector<bool> m_macHack; 113 enum FP_PROPS_RETVALUE m_returnValue; // the option that closed the dialog 114 115 PANEL_FP_PROPERTIES_3D_MODEL* m_3dPanel; 116 117 bool m_initialized; 118 }; 119 120 121 #endif // DIALOG_FOOTPRINT_PROPERTIES_H 122