KiCad PCB EDA Suite
Loading...
Searching...
No Matches
edit.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
5 * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <[email protected]>
6 * Copyright (C) 2015 Wayne Stambaugh <[email protected]>
7 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#include <kiface_base.h>
24#include <confirm.h>
25#include <gestfich.h>
26#include <pcb_edit_frame.h>
27#include <pcbnew_id.h>
28#include <board.h>
29#include <footprint.h>
30#include <pad.h>
31#include <zone.h>
32#include <pcb_group.h>
33#include <pcb_generator.h>
34#include <pcb_target.h>
35#include <pcb_dimension.h>
36#include <pcb_textbox.h>
37#include <pcb_barcode.h>
38#include <pcb_table.h>
39#include <pcb_shape.h>
40#include <dialog_drc.h>
42#include <tool/tool_manager.h>
43#include <tools/pcb_actions.h>
44#include <tools/drc_tool.h>
48
49// Handles the selection of command events.
50void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
51{
52 switch( event.GetId() ) // Execute command
53 {
54 case ID_MENU_EXPORT_FOOTPRINTS_TO_LIBRARY:
56 break;
57
58 case ID_MENU_EXPORT_FOOTPRINTS_TO_NEW_LIBRARY:
60 break;
61
62 default:
63 break;
64 }
65}
66
67
69{
70 PCB_LAYER_ID curLayer = GetActiveLayer();
71 const PCB_DISPLAY_OPTIONS& displ_opts = GetDisplayOptions();
72
73 // Check if the specified layer matches the present layer
74 if( layer == curLayer )
75 return;
76
77 // Copper layers cannot be selected unconditionally; how many of those layers are currently
78 // enabled needs to be checked.
79 if( IsCopperLayer( layer ) )
80 {
81 if( layer > GetBoard()->GetCopperLayerStackMaxId() )
82 return;
83 }
84
85 // Is yet more checking required? E.g. when the layer to be selected is a non-copper layer,
86 // or when switching between a copper layer and a non-copper layer, or vice-versa?
87
88 SetActiveLayer( layer );
89
91 GetCanvas()->Refresh();
92}
93
94
96{
97 switch( aItem->Type() )
98 {
101 break;
102
103 case PCB_FIELD_T:
104 case PCB_TEXT_T:
105 ShowTextPropertiesDialog( static_cast<PCB_TEXT*>( aItem ) );
106 break;
107
108 case PCB_TEXTBOX_T:
109 ShowTextBoxPropertiesDialog( static_cast<PCB_TEXTBOX*>( aItem ) );
110 break;
111
112 case PCB_TABLE_T:
113 {
114 DIALOG_TABLE_PROPERTIES dlg( this, static_cast<PCB_TABLE*>( aItem ) );
115
116 //QuasiModal required for Scintilla auto-complete
117 dlg.ShowQuasiModal();
118 break;
119 }
120
121 case PCB_PAD_T:
122 ShowPadPropertiesDialog( static_cast<PAD*>( aItem ) );
123 break;
124
125 case PCB_FOOTPRINT_T:
126 ShowFootprintPropertiesDialog( static_cast<FOOTPRINT*>( aItem ) );
127 break;
128
129 case PCB_TARGET_T:
130 ShowTargetOptionsDialog( static_cast<PCB_TARGET*>( aItem ) );
131 break;
132
134 case PCB_DIM_CENTER_T:
135 case PCB_DIM_RADIAL_T:
137 case PCB_DIM_LEADER_T:
138 {
139 DIALOG_DIMENSION_PROPERTIES dlg( this, static_cast<PCB_DIMENSION_BASE*>( aItem ) );
140
141 dlg.ShowModal();
142 break;
143 }
144
145 case PCB_SHAPE_T:
146 ShowGraphicItemPropertiesDialog( static_cast<PCB_SHAPE*>( aItem ) );
147 break;
148
149 case PCB_BARCODE_T:
150 ShowBarcodePropertiesDialog( static_cast<PCB_BARCODE*>( aItem ) );
151 break;
152
153 case PCB_ZONE_T:
154 Edit_Zone_Params( static_cast<ZONE*>( aItem ) );
155 break;
156
157 case PCB_GROUP_T:
159 static_cast<EDA_GROUP*>( static_cast<PCB_GROUP*>( aItem ) ) );
160 break;
161
162 case PCB_GENERATOR_T:
163 static_cast<PCB_GENERATOR*>( aItem )->ShowPropertiesDialog( this );
164 break;
165
166 case PCB_MARKER_T:
167 m_toolManager->GetTool<DRC_TOOL>()->CrossProbe( static_cast<PCB_MARKER*>( aItem ) );
168 break;
169
170 case PCB_POINT_T:
171 break;
172
173 default:
174 break;
175 }
176}
177
@ NORMAL
Inactive layers are shown normally (no high-contrast mode)
static TOOL_ACTION groupProperties
Definition actions.h:243
A base class for any item which can be embedded within the BOARD container class, and therefore insta...
Definition board_item.h:81
int ShowModal() override
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
A set of EDA_ITEMs (i.e., without duplicates).
Definition eda_group.h:42
KICAD_T Type() const
Returns the type of object.
Definition eda_item.h:108
Definition pad.h:61
int ShowTextBoxPropertiesDialog(PCB_TEXTBOX *aTextBox)
void ShowReferenceImagePropertiesDialog(BOARD_ITEM *aBitmap)
void ShowBarcodePropertiesDialog(PCB_BARCODE *aText)
void ShowGraphicItemPropertiesDialog(PCB_SHAPE *aShape)
void ShowPadPropertiesDialog(PAD *aPad)
const PCB_DISPLAY_OPTIONS & GetDisplayOptions() const
Display options control the way tracks, vias, outlines and other things are shown (for instance solid...
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
virtual PCB_LAYER_ID GetActiveLayer() const
BOARD * GetBoard() const
Abstract dimension API.
HIGH_CONTRAST_MODE m_ContrastModeDisplay
How inactive layers are displayed.
void OnEditItemRequest(BOARD_ITEM *aItem) override
Install the corresponding dialog editor for the given item.
Definition edit.cpp:95
void SetActiveLayer(PCB_LAYER_ID aLayer) override
Change the currently active layer to aLayer and also update the APPEARANCE_CONTROLS.
void SwitchLayer(PCB_LAYER_ID layer) override
Change the active layer in the editor.
Definition edit.cpp:68
void ShowTargetOptionsDialog(PCB_TARGET *aTarget)
void ExportFootprintsToLibrary(bool aStoreInNewLib, const wxString &aLibName=wxEmptyString, wxString *aLibPath=nullptr)
Save footprints in a library:
void ShowFootprintPropertiesDialog(FOOTPRINT *aFootprint)
void Edit_Zone_Params(ZONE *zone_container)
Edit params (layer, clearance, ...) for a zone outline.
void Process_Special_Functions(wxCommandEvent &event)
Definition edit.cpp:50
A set of BOARD_ITEMs (i.e., without duplicates).
Definition pcb_group.h:49
TOOL_MANAGER * m_toolManager
Handle a list of polygons defining a copper zone.
Definition zone.h:70
This file is part of the common library.
bool IsCopperLayer(int aLayerId)
Test whether a layer is a copper layer.
Definition layer_ids.h:675
PCB_LAYER_ID
A quick note on layer IDs:
Definition layer_ids.h:56
BARCODE class definition.
Class to handle a set of BOARD_ITEMs.
@ PCB_SHAPE_T
class PCB_SHAPE, a segment not on copper layers
Definition typeinfo.h:81
@ PCB_DIM_ORTHOGONAL_T
class PCB_DIM_ORTHOGONAL, a linear dimension constrained to x/y
Definition typeinfo.h:99
@ PCB_DIM_LEADER_T
class PCB_DIM_LEADER, a leader dimension (graphic item)
Definition typeinfo.h:96
@ PCB_GENERATOR_T
class PCB_GENERATOR, generator on a layer
Definition typeinfo.h:84
@ PCB_DIM_CENTER_T
class PCB_DIM_CENTER, a center point marking (graphic item)
Definition typeinfo.h:97
@ PCB_GROUP_T
class PCB_GROUP, a set of BOARD_ITEMs
Definition typeinfo.h:104
@ PCB_TEXTBOX_T
class PCB_TEXTBOX, wrapped text on a layer
Definition typeinfo.h:86
@ PCB_ZONE_T
class ZONE, a copper pour area
Definition typeinfo.h:101
@ PCB_TEXT_T
class PCB_TEXT, text on a layer
Definition typeinfo.h:85
@ PCB_REFERENCE_IMAGE_T
class PCB_REFERENCE_IMAGE, bitmap on a layer
Definition typeinfo.h:82
@ PCB_FIELD_T
class PCB_FIELD, text associated with a footprint property
Definition typeinfo.h:83
@ PCB_MARKER_T
class PCB_MARKER, a marker used to show something
Definition typeinfo.h:92
@ PCB_BARCODE_T
class PCB_BARCODE, a barcode (graphic item)
Definition typeinfo.h:94
@ PCB_TARGET_T
class PCB_TARGET, a target (graphic item)
Definition typeinfo.h:100
@ PCB_FOOTPRINT_T
class FOOTPRINT, a footprint
Definition typeinfo.h:79
@ PCB_DIM_ALIGNED_T
class PCB_DIM_ALIGNED, a linear dimension (graphic item)
Definition typeinfo.h:95
@ PCB_PAD_T
class PAD, a pad in a footprint
Definition typeinfo.h:80
@ PCB_TABLE_T
class PCB_TABLE, table of PCB_TABLECELLs
Definition typeinfo.h:87
@ PCB_POINT_T
class PCB_POINT, a 0-dimensional point
Definition typeinfo.h:106
@ PCB_DIM_RADIAL_T
class PCB_DIM_RADIAL, a radius or diameter dimension
Definition typeinfo.h:98