KiCad PCB EDA Suite
footprint_edit_frame.cpp File Reference
#include <fctsys.h>
#include <kiface_i.h>
#include <kiway.h>
#include <project.h>
#include <kicad_plugin.h>
#include <class_drawpanel.h>
#include <pcb_draw_panel_gal.h>
#include <confirm.h>
#include <pcb_edit_frame.h>
#include <dialog_helpers.h>
#include <3d_viewer/eda_3d_viewer.h>
#include <msgpanel.h>
#include <fp_lib_table.h>
#include <bitmaps.h>
#include <gal/graphics_abstraction_layer.h>
#include <eda_dockart.h>
#include <class_board.h>
#include <class_module.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <hotkeys.h>
#include <footprint_edit_frame.h>
#include <footprint_viewer_frame.h>
#include <wildcards_and_files_ext.h>
#include <pcb_layer_widget.h>
#include <invoke_pcb_dialog.h>
#include <tool/tool_manager.h>
#include <tool/common_tools.h>
#include <tool/tool_dispatcher.h>
#include <tool/zoom_tool.h>
#include <footprint_tree_pane.h>
#include <widgets/lib_tree.h>
#include <footprint_info_impl.h>
#include <widgets/paged_dialog.h>
#include <dialogs/panel_modedit_settings.h>
#include <dialogs/panel_modedit_defaults.h>
#include <dialogs/panel_modedit_display_options.h>
#include <dialog_configure_paths.h>
#include <tools/position_relative_tool.h>
#include <widgets/progress_reporter.h>
#include "tools/selection_tool.h"
#include "tools/edit_tool.h"
#include "tools/drawing_tool.h"
#include "tools/point_editor.h"
#include "tools/pcbnew_control.h"
#include "tools/footprint_editor_tools.h"
#include "tools/placement_tool.h"
#include "tools/picker_tool.h"
#include "tools/pad_tool.h"
#include "tools/pcb_actions.h"

Go to the source code of this file.

Functions

 EVT_MENU_RANGE (ID_POPUP_PCB_ITEM_SELECTION_START, ID_POPUP_PCB_ITEM_SELECTION_END, PCB_BASE_FRAME::ProcessItemSelection) EVT_TOOL_RANGE(ID_MODEDIT_PAD_TOOL
 
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar EVT_MENU (ID_PREFERENCES_HOTKEY_SHOW_CURRENT_LIST, FOOTPRINT_EDIT_FRAME::ProcessPreferences) EVT_MENU(ID_PCB_LIB_TABLE_EDIT
 
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar FOOTPRINT_EDIT_FRAME::ProcessPreferences EVT_MENU (wxID_PREFERENCES, FOOTPRINT_EDIT_FRAME::ProcessPreferences) EVT_MENU_RANGE(ID_POPUP_PCB_START_RANGE
 
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions EVT_MENU_RANGE (ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions) EVT_MENU(ID_POPUP_MODEDIT_EDIT_BODY_ITEM
 
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions EVT_MENU (ID_POPUP_MODEDIT_EDIT_WIDTH_ALL_EDGE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions) EVT_MENU(ID_POPUP_MODEDIT_EDIT_LAYER_ALL_EDGE
 
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions EVT_UPDATE_UI (ID_MODEDIT_LOAD_MODULE_FROM_BOARD, FOOTPRINT_EDIT_FRAME::OnUpdateLoadModuleFromBoard) EVT_UPDATE_UI(ID_MODEDIT_INSERT_MODULE_IN_BOARD
 
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard EVT_UPDATE_UI_RANGE (ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL, FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar) EVT_UPDATE_UI(ID_TB_OPTIONS_SHOW_HIGH_CONTRAST_MODE
 
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar FOOTPRINT_EDIT_FRAME::ProcessPreferences FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::Process_Special_Functions FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar EVT_UPDATE_UI (ID_MODEDIT_SHOW_HIDE_SEARCH_TREE, FOOTPRINT_EDIT_FRAME::OnUpdateOptionsToolbar) FOOTPRINT_EDIT_FRAME
 

Variables

 ID_MODEDIT_MEASUREMENT_TOOL
 
FOOTPRINT_EDIT_FRAME::OnVerticalToolbar FOOTPRINT_EDIT_FRAME::ProcessPreferences ID_POPUP_PCB_END_RANGE
 

Function Documentation

Definition at line 205 of file footprint_edit_frame.cpp.

References PAGE_INFO::A4, PCAD2KICAD::Center, F_SilkS, g_Module_Editor_Hotkeys_Descr, EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE, GetBoard(), BOARD_DESIGN_SETTINGS::GetDefault(), BOARD::GetDesignSettings(), ID_POPUP_GRID_LEVEL_1000, ID_POPUP_GRID_USER, KiBitmap(), LAYER_NO_CONNECTS, PCAD2KICAD::Left, BOARD_DESIGN_SETTINGS::m_SolderMaskMargin, PCAD2KICAD::Right, BOARD::SetElementVisibility(), BOARD::SetVisibleAlls(), and UNSCALED_UNITS.

214  :
215  PCB_BASE_EDIT_FRAME( aKiway, aParent, FRAME_PCB_MODULE_EDITOR, wxEmptyString,
216  wxDefaultPosition, wxDefaultSize,
217  KICAD_DEFAULT_DRAWFRAME_STYLE, GetFootprintEditorFrameName() )
218 {
219  m_showBorderAndTitleBlock = false; // true to show the frame references
220  m_showAxis = true; // true to show X and Y axis on screen
221  m_showGridAxis = true; // show the grid origin axis
222  m_hotkeysDescrList = g_Module_Editor_Hotkeys_Descr;
223 
224  // Give an icon
225  wxIcon icon;
226  icon.CopyFromBitmap( KiBitmap( icon_modedit_xpm ) );
227  SetIcon( icon );
228 
229  // Create GAL canvas
230  PCB_DRAW_PANEL_GAL* drawPanel = new PCB_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
231  GetGalDisplayOptions(), aBackend );
232  SetGalCanvas( drawPanel );
233 
234  SetBoard( new BOARD() );
235  // In modedit, the default net clearance is not known.
236  // (it depends on the actual board)
237  // So we do not show the default clearance, by setting it to 0
238  // The footprint or pad specific clearance will be shown
239  GetBoard()->GetDesignSettings().GetDefault()->SetClearance( 0 );
240 
241  // Don't show the default board solder mask clearance in the footprint editor. Only the
242  // footprint or pad clearance setting should be shown if it is not 0.
244 
245  // restore the last footprint from the project, if any
246  restoreLastFootprint();
247 
248  // Ensure all layers and items are visible:
249  // In footprint editor, some layers have no meaning or
250  // cannot be used, but we show all of them, at least to be able
251  // to edit a bad layer
253 
254  // However the "no net" mark on pads is useless, because there is
255  // no net in footprint editor: make it non visible
257 
258  m_Layers = new PCB_LAYER_WIDGET( this, GetCanvas(), true );
259 
260  // LoadSettings() *after* creating m_LayersManager, because LoadSettings()
261  // initialize parameters in m_LayersManager
262  LoadSettings( config() );
263  GetGalDisplayOptions().m_axesEnabled = true;
264 
265  SetScreen( new PCB_SCREEN( GetPageSettings().GetSizeIU() ) );
266  GetScreen()->SetMaxUndoItems( m_UndoRedoCountMax );
267  GetScreen()->SetCurItem( NULL );
268 
269  GetScreen()->AddGrid( m_UserGridSize, EDA_UNITS_T::UNSCALED_UNITS, ID_POPUP_GRID_USER );
270  GetScreen()->SetGrid( ID_POPUP_GRID_LEVEL_1000 + m_LastGridSizeId );
271 
272  // In modedit, set the default paper size to A4:
273  // this should be OK for all footprint to plot/print
274  SetPageSettings( PAGE_INFO( PAGE_INFO::A4 ) );
275 
276  SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
277 
278  initLibraryTree();
279  m_treePane = new FOOTPRINT_TREE_PANE( this );
280 
281  // ReCreateMenuBar(); // UseGalCanvas() will do this for us.
282  ReCreateHToolbar();
283  ReCreateVToolbar();
284  ReCreateOptToolbar();
285 
286  m_Layers->ReFill();
287  m_Layers->ReFillRender();
288 
289  GetScreen()->m_Active_Layer = F_SilkS;
290  m_Layers->SelectLayer( F_SilkS );
291  m_Layers->OnLayerSelected();
292 
293  if( m_canvas )
294  m_canvas->SetEnableBlockCommands( true );
295 
296  m_auimgr.SetManagedWindow( this );
297  m_auimgr.SetArtProvider( new EDA_DOCKART( this ) );
298 
299  // Horizontal items; layers 4 - 6
300  m_auimgr.AddPane( m_mainToolBar, EDA_PANE().HToolbar().Name( "MainToolbar" ).Top().Layer(6) );
301  m_auimgr.AddPane( m_messagePanel, EDA_PANE().Messages().Name( "MsgPanel" ).Bottom().Layer(6) );
302 
303  // Vertical items; layers 1 - 3
304  m_auimgr.AddPane( m_optionsToolBar, EDA_PANE().VToolbar().Name( "OptToolbar" ).Left().Layer(3) );
305  m_auimgr.AddPane( m_treePane, EDA_PANE().Palette().Name( "Footprints" ).Left().Layer(1)
306  .Caption( _( "Libraries" ) ).MinSize( 250, 400 ) );
307 
308  m_auimgr.AddPane( m_drawToolBar, EDA_PANE().VToolbar().Name( "ToolsToolbar" ).Right().Layer(1) );
309  m_auimgr.AddPane( m_Layers, EDA_PANE().Palette().Name( "LayersManager" ).Right().Layer(3)
310  .Caption( _( "Layers Manager" ) ).PaneBorder( false )
311  .MinSize( 80, -1 ).BestSize( m_Layers->GetBestSize() ) );
312 
313  m_auimgr.AddPane( m_canvas, EDA_PANE().Canvas().Name( "DrawFrame" ).Center() );
314  m_auimgr.AddPane( GetGalCanvas(), EDA_PANE().Canvas().Name( "DrawFrameGal" ).Center().Hide() );
315 
316  // Create the manager and dispatcher & route draw panel events to the dispatcher
317  setupTools();
318  GetGalCanvas()->GetGAL()->SetAxesEnabled( true );
319  UseGalCanvas( aBackend != EDA_DRAW_PANEL_GAL::GAL_TYPE_NONE );
320 
321  m_auimgr.Update();
322  updateTitle();
323 
324  Raise(); // On some window managers, this is needed
325  Show( true );
326 
327  Zoom_Automatique( false );
328 }
int m_SolderMaskMargin
Solder mask margin.
show a marker on pads with no nets
NETCLASSPTR GetDefault() const
Function GetDefault.
void SetElementVisibility(GAL_LAYER_ID aLayer, bool aNewState)
Function SetElementVisibility changes the visibility of an element category.
Class PCB_LAYER_WIDGET is here to implement the abstract functions of LAYER_WIDGET so they may be tie...
struct EDA_HOTKEY_CONFIG g_Module_Editor_Hotkeys_Descr[]
void SetVisibleAlls()
Function SetVisibleAlls changes the bit-mask of visible element categories and layers.
wxBitmap KiBitmap(BITMAP_DEF aBitmap)
Construct a wxBitmap from a memory record, held in a BITMAP_DEF.
Definition: bitmap.cpp:79
Class PAGE_INFO describes the page size and margins of a paper page on which to eventually print or p...
Definition: page_info.h:54
BOARD_DESIGN_SETTINGS & GetDesignSettings() const
Function GetDesignSettings.
Definition: class_board.h:538
static const wxChar A4[]
Definition: page_info.h:64
#define KICAD_DEFAULT_DRAWFRAME_STYLE
Footprint Editor pane with footprint library tree.
Specialization of the wxAuiPaneInfo class for KiCad panels.
BOARD * GetBoard()
Common, abstract interface for edit frames.
Class BOARD holds information pertinent to a Pcbnew printed circuit board.
Definition: class_board.h:170

Variable Documentation