Move DRC control to a tool; move assorted commands to ACTIONS.

This commit is contained in:
Jeff Young 2019-06-03 14:49:17 +01:00
parent 9f1e2e34b7
commit 568c8c336b
47 changed files with 472 additions and 844 deletions

View File

@ -358,6 +358,11 @@ TOOL_ACTION ACTIONS::show3DViewer( "common.Control.show3DViewer",
_( "3D Viewer" ), _( "Show 3D viewer window" ),
three_d_xpm );
TOOL_ACTION ACTIONS::updatePcbFromSchematic( "common.Control.updatePcbFromSchematic",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_UPDATE_PCB_FROM_SCH ),
_( "Update PCB from Schematic..." ), _( "Push changes from schematic to PCB" ),
update_pcb_from_sch_xpm );
TOOL_ACTION ACTIONS::configurePaths( "common.Control.configurePaths",
AS_GLOBAL, 0,
_( "Configure Paths..." ), _( "Edit path configuration environment variables" ),
@ -386,16 +391,10 @@ TOOL_ACTION ACTIONS::standardGraphics( "common.Control.standardGraphics",
tools_xpm );
// System-wide selection Events
///> Event sent after an item is selected.
const TOOL_EVENT EVENTS::SelectedEvent( TC_MESSAGE, TA_ACTION, "common.Interactive.selected" );
///> Event sent after an item is unselected.
const TOOL_EVENT EVENTS::UnselectedEvent( TC_MESSAGE, TA_ACTION, "common.Interactive.unselected" );
///> Event sent after selection is cleared.
const TOOL_EVENT EVENTS::ClearedEvent( TC_MESSAGE, TA_ACTION, "common.Interactive.cleared" );
const TOOL_EVENT EVENTS::SelectedItemsModified( TC_MESSAGE, TA_ACTION, "common.Interactive.modified" );

View File

@ -223,7 +223,6 @@ set( EESCHEMA_SRCS
netlist_exporters/netlist_exporter_orcadpcb2.cpp
netlist_exporters/netlist_exporter_pspice.cpp
tools/ee_actions.cpp
tools/ee_inspection_tool.cpp
tools/ee_picker_tool.cpp
tools/ee_point_editor.cpp

View File

@ -67,7 +67,6 @@ enum hotkey_id_command {
HK_ADD_NOCONN_FLAG,
HK_LEAVE_SHEET,
HK_AUTOPLACE_FIELDS,
HK_UPDATE_PCB_FROM_SCH,
HK_SELECT_ITEMS_ON_PCB,
HK_CANVAS_OPENGL,
HK_CANVAS_CAIRO,

View File

@ -64,7 +64,6 @@ enum id_eeschema_frm
/* Schematic editor horizontal toolbar IDs */
ID_TO_LIBVIEW,
ID_BACKANNO_ITEMS,
ID_UPDATE_FIELDS,
/* Schematic editor vertical toolbar IDs */
ID_HIGHLIGHT_TOOL,

View File

@ -144,28 +144,24 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
return GetScreen() && GetScreen()->GetRedoCommandCount() > 0;
};
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
editMenu->AddItem( ACTIONS::undo, enableUndoCondition );
editMenu->AddItem( ACTIONS::redo, enableRedoCondition );
editMenu->AddSeparator();
editMenu->AddItem( ACTIONS::cut, EE_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::copy, EE_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::paste, EE_CONDITIONS::Idle );
editMenu->AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::cut, EE_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::copy, EE_CONDITIONS::NotEmpty );
editMenu->AddItem( ACTIONS::paste, EE_CONDITIONS::Idle );
editMenu->AddItem( ACTIONS::duplicate, EE_CONDITIONS::NotEmpty );
editMenu->AddSeparator();
editMenu->AddItem( EE_ACTIONS::deleteItemCursor, EE_CONDITIONS::ShowAlways );
// Find
editMenu->AddSeparator();
editMenu->AddItem( ACTIONS::find, EE_CONDITIONS::ShowAlways );
editMenu->AddItem( ACTIONS::findAndReplace, EE_CONDITIONS::ShowAlways );
editMenu->AddItem( EE_ACTIONS::deleteItemCursor, EE_CONDITIONS::ShowAlways );
editMenu->AddSeparator();
// Update field values
editMenu->AddItem( ID_UPDATE_FIELDS, _( "Update Fields from Library..." ),
_( "Sets symbol fields to original library values" ),
update_fields_xpm, EE_CONDITIONS::ShowAlways );
editMenu->AddItem( ACTIONS::find, EE_CONDITIONS::ShowAlways );
editMenu->AddItem( ACTIONS::findAndReplace, EE_CONDITIONS::ShowAlways );
editMenu->AddSeparator();
editMenu->AddItem( EE_ACTIONS::updateFieldsFromLibrary, EE_CONDITIONS::ShowAlways );
editMenu->Resolve();
@ -276,7 +272,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar()
return schematic.HasNoFullyDefinedLibIds();
};
toolsMenu->AddItem( EE_ACTIONS::updatePcbFromSchematic, EE_CONDITIONS::ShowAlways );
toolsMenu->AddItem( ACTIONS::updatePcbFromSchematic, EE_CONDITIONS::ShowAlways );
toolsMenu->AddItem( EE_ACTIONS::showPcbNew, EE_CONDITIONS::ShowAlways );
toolsMenu->AddSeparator();

View File

@ -236,7 +236,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
EVT_TOOL( ID_GET_NETLIST, SCH_EDIT_FRAME::OnCreateNetlist )
EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile )
EVT_TOOL( ID_UPDATE_FIELDS, SCH_EDIT_FRAME::OnUpdateFields )
EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings )
END_EVENT_TABLE()
@ -777,21 +776,6 @@ void SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile( wxCommandEvent& event )
}
void SCH_EDIT_FRAME::OnUpdateFields( wxCommandEvent& event )
{
std::list<SCH_COMPONENT*> components;
for( SCH_ITEM* item = GetScreen()->GetDrawItems(); item; item = item->Next() )
{
if( item->Type() == SCH_COMPONENT_T )
components.push_back( static_cast<SCH_COMPONENT*>( item ) );
}
if( InvokeDialogUpdateFields( this, components, true ) == wxID_OK )
GetCanvas()->Refresh();
}
void SCH_EDIT_FRAME::NewProject()
{
wxString pro_dir = m_mruPath;

View File

@ -762,11 +762,9 @@ private:
void OnExit( wxCommandEvent& event );
void OnCreateNetlist( wxCommandEvent& event );
void OnSimulate( wxCommandEvent& event );
void OnLoadFile( wxCommandEvent& event );
void OnLoadCmpToFootprintLinkFile( wxCommandEvent& event );
void OnUpdateFields( wxCommandEvent& event );
void OnAppendProject( wxCommandEvent& event );
void OnImportProject( wxCommandEvent& event );

View File

@ -32,18 +32,17 @@
#include <confirm.h>
#include <bitmaps.h>
#include <wildcards_and_files_ext.h>
#include <widgets/tuner_slider.h>
#include <dialogs/dialog_signal_list.h>
#include "netlist_exporter_pspice_sim.h"
#include <pgm_base.h>
#include "sim_plot_frame.h"
#include "sim_plot_panel.h"
#include "spice_simulator.h"
#include "spice_reporter.h"
#include <menus_helpers.h>
#include <tool/tool_manager.h>
#include <tools/ee_actions.h>
SIM_PLOT_TYPE operator|( SIM_PLOT_TYPE aFirst, SIM_PLOT_TYPE aSecond )
{
@ -1191,7 +1190,7 @@ void SIM_PLOT_FRAME::onProbe( wxCommandEvent& event )
if( m_schematicFrame == NULL )
return;
wxQueueEvent( m_schematicFrame, new wxCommandEvent( wxEVT_TOOL, ID_SIM_PROBE ) );
m_schematicFrame->GetToolManager()->RunAction( EE_ACTIONS::simProbe );
m_schematicFrame->Raise();
}
@ -1201,7 +1200,7 @@ void SIM_PLOT_FRAME::onTune( wxCommandEvent& event )
if( m_schematicFrame == NULL )
return;
wxQueueEvent( m_schematicFrame, new wxCommandEvent( wxEVT_TOOL, ID_SIM_TUNE ) );
m_schematicFrame->GetToolManager()->RunAction( EE_ACTIONS::simTune );
m_schematicFrame->Raise();
}

View File

@ -1,56 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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
*/
#include <common.h>
#include <eeschema_id.h>
#include <tools/ee_actions.h>
char g_lastBusEntryShape = '/';
OPT<TOOL_EVENT> EE_ACTIONS::TranslateLegacyId( int aId )
{
switch( aId )
{
case ID_CANCEL_CURRENT_COMMAND:
return ACTIONS::cancelInteractive.MakeEvent();
case ID_SIM_PROBE:
return EE_ACTIONS::simProbe.MakeEvent();
case ID_SIM_TUNE:
return EE_ACTIONS::simTune.MakeEvent();
case ID_SCH_UNFOLD_BUS:
return EE_ACTIONS::unfoldBus.MakeEvent();
case ID_MOUSE_CLICK:
return ACTIONS::cursorClick.MakeEvent();
case ID_MOUSE_DOUBLECLICK:
return ACTIONS::cursorDblClick.MakeEvent();
}
return OPT<TOOL_EVENT>();
}

View File

@ -153,6 +153,8 @@ public:
static TOOL_ACTION annotate;
static TOOL_ACTION editSymbolFields;
static TOOL_ACTION editSymbolLibraryLinks;
static TOOL_ACTION pinTable;
static TOOL_ACTION updateFieldsFromLibrary;
static TOOL_ACTION assignFootprints;
static TOOL_ACTION showBusManager;
@ -178,7 +180,6 @@ public:
static TOOL_ACTION cleanupSheetPins;
static TOOL_ACTION toggleHiddenPins;
static TOOL_ACTION symbolProperties;
static TOOL_ACTION pinTable;
static TOOL_ACTION deleteItemCursor;
static TOOL_ACTION refreshPreview;
static TOOL_ACTION explicitCrossProbe;
@ -200,7 +201,7 @@ public:
static TOOL_ACTION highlightNetCursor;
///> @copydoc COMMON_ACTIONS::TranslateLegacyId()
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override;
virtual OPT<TOOL_EVENT> TranslateLegacyId( int aId ) override { return OPT<TOOL_EVENT>(); }
};

View File

@ -46,6 +46,7 @@
#include <eeschema_id.h>
#include <status_popup.h>
#include <wx/gdicmn.h>
#include <invoke_sch_dialog.h>
#include "sch_drawing_tools.h"
@ -99,6 +100,11 @@ TOOL_ACTION EE_ACTIONS::autoplaceFields( "eeschema.InteractiveEdit.autoplaceFiel
_( "Autoplace Fields" ), _( "Runs the automatic placement algorithm on the symbol's fields" ),
autoplace_fields_xpm );
TOOL_ACTION EE_ACTIONS::updateFieldsFromLibrary( "eeschema.InteractiveEdit.updateFieldsFromLibrary",
AS_GLOBAL, 0,
_( "Update Fields from Library..." ), _( "Sets symbol fields to original library values" ),
update_fields_xpm );
TOOL_ACTION EE_ACTIONS::toggleDeMorgan( "eeschema.InteractiveEdit.toggleDeMorgan",
AS_GLOBAL, 0,
_( "DeMorgan Conversion" ), _( "Switch between DeMorgan representations" ),
@ -175,6 +181,9 @@ TOOL_ACTION EE_ACTIONS::breakBus( "eeschema.InteractiveEdit.breakBus",
break_line_xpm );
char g_lastBusEntryShape = '/';
class SYMBOL_UNIT_MENU : public ACTION_MENU
{
public:
@ -184,7 +193,6 @@ public:
SetTitle( _( "Symbol Unit" ) );
}
protected:
ACTION_MENU* create() const override
{
@ -240,11 +248,6 @@ SCH_EDIT_TOOL::SCH_EDIT_TOOL() :
}
SCH_EDIT_TOOL::~SCH_EDIT_TOOL()
{
}
using E_C = EE_CONDITIONS;
bool SCH_EDIT_TOOL::Init()
@ -1124,6 +1127,23 @@ int SCH_EDIT_TOOL::AutoplaceFields( const TOOL_EVENT& aEvent )
}
int SCH_EDIT_TOOL::UpdateFields( const TOOL_EVENT& aEvent )
{
std::list<SCH_COMPONENT*> components;
for( SCH_ITEM* item = m_frame->GetScreen()->GetDrawItems(); item; item = item->Next() )
{
if( item->Type() == SCH_COMPONENT_T )
components.push_back( static_cast<SCH_COMPONENT*>( item ) );
}
if( InvokeDialogUpdateFields( m_frame, components, true ) == wxID_OK )
m_frame->GetCanvas()->Refresh();
return 0;
}
int SCH_EDIT_TOOL::ConvertDeMorgan( const TOOL_EVENT& aEvent )
{
SELECTION& selection = m_selectionTool->RequestSelection( EE_COLLECTOR::ComponentsOnly );
@ -1369,6 +1389,7 @@ void SCH_EDIT_TOOL::setTransitions()
Go( &SCH_EDIT_TOOL::EditField, EE_ACTIONS::editValue.MakeEvent() );
Go( &SCH_EDIT_TOOL::EditField, EE_ACTIONS::editFootprint.MakeEvent() );
Go( &SCH_EDIT_TOOL::AutoplaceFields, EE_ACTIONS::autoplaceFields.MakeEvent() );
Go( &SCH_EDIT_TOOL::UpdateFields, EE_ACTIONS::updateFieldsFromLibrary.MakeEvent() );
Go( &SCH_EDIT_TOOL::ConvertDeMorgan, EE_ACTIONS::toggleDeMorgan.MakeEvent() );
Go( &SCH_EDIT_TOOL::ConvertDeMorgan, EE_ACTIONS::showDeMorganStandard.MakeEvent() );
Go( &SCH_EDIT_TOOL::ConvertDeMorgan, EE_ACTIONS::showDeMorganAlternate.MakeEvent() );

View File

@ -36,7 +36,7 @@ class SCH_EDIT_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>
{
public:
SCH_EDIT_TOOL();
~SCH_EDIT_TOOL();
~SCH_EDIT_TOOL() { }
/// @copydoc TOOL_INTERACTIVE::Init()
bool Init() override;
@ -50,6 +50,7 @@ public:
int Properties( const TOOL_EVENT& aEvent );
int EditField( const TOOL_EVENT& aEvent );
int AutoplaceFields( const TOOL_EVENT& aEvent );
int UpdateFields( const TOOL_EVENT& aEvent );
int ConvertDeMorgan( const TOOL_EVENT& aEvent );
int ChangeShape( const TOOL_EVENT& aEvent );

View File

@ -121,11 +121,6 @@ TOOL_ACTION EE_ACTIONS::showPcbNew( "eeschema.EditorControl.showPcbNew",
_( "Open PCB Editor" ), _( "Run Pcbnew" ),
pcbnew_xpm );
TOOL_ACTION EE_ACTIONS::updatePcbFromSchematic( "eeschema.EditorControl.updatePcbFromSchematic",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_UPDATE_PCB_FROM_SCH ),
_( "Update PCB from Schematic..." ), _( "Push changes from schematic to PCB" ),
update_pcb_from_sch_xpm );
TOOL_ACTION EE_ACTIONS::generateBOM( "eeschema.EditorControl.generateBOM",
AS_GLOBAL, 0,
_( "Generate BOM..." ), _( "Generate a bill of materials for the current schematic" ),
@ -1274,7 +1269,7 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::EditSymbolFields, EE_ACTIONS::editSymbolFields.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::EditSymbolLibraryLinks,EE_ACTIONS::editSymbolLibraryLinks.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowPcbNew, EE_ACTIONS::showPcbNew.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdatePCB, EE_ACTIONS::updatePcbFromSchematic.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::UpdatePCB, ACTIONS::updatePcbFromSchematic.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::GenerateBOM, EE_ACTIONS::generateBOM.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ShowBusManager, EE_ACTIONS::showBusManager.MakeEvent() );

View File

@ -296,6 +296,7 @@ enum common_hotkey_id_command {
HK_PREFERENCES,
HK_TOGGLE_CURSOR,
HK_MEASURE_TOOL,
HK_UPDATE_PCB_FROM_SCH,
HK_COMMON_END
};

View File

@ -141,6 +141,7 @@ public:
// Misc
static TOOL_ACTION show3DViewer;
static TOOL_ACTION updatePcbFromSchematic;
static TOOL_ACTION configurePaths;
static TOOL_ACTION showSymbolLibTable;
static TOOL_ACTION showFootprintLibTable;

View File

@ -235,8 +235,8 @@ set( PCBNEW_CLASS_SRCS
board_netlist_updater.cpp
build_BOM_from_board.cpp
cross-probing.cpp
drc.cpp
drc_clearance_test_functions.cpp
tools/drc.cpp
tools/drc_clearance_test_functions.cpp
edit.cpp
edit_track_width.cpp
files.cpp

View File

@ -47,12 +47,9 @@
#include <class_module.h>
#include <class_track.h>
#include <class_zone.h>
#include <collectors.h>
#include <pcbnew.h>
#include <pcb_netlist.h>
#include <dialogs/dialog_update_pcb.h>
#include <tools/pcb_actions.h>
#include <tool/tool_manager.h>
#include <tools/selection_tool.h>
@ -382,14 +379,8 @@ void PCB_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
break;
case MAIL_PCB_UPDATE:
{
NETLIST netlist;
if( FetchNetlistFromSchematic( netlist, ANNOTATION_DIALOG ) )
UpdatePCBFromNetlist( netlist );
m_toolManager->RunAction( ACTIONS::updatePcbFromSchematic, true );
break;
}
case MAIL_IMPORT_FILE:
{

View File

@ -27,7 +27,7 @@
#include <dialog_cleanup_tracks_and_vias_base.h>
#include <drc.h>
#include <tools/drc.h>
#include <wx/config.h>

View File

@ -30,7 +30,7 @@
#include <wx/htmllbox.h>
#include <fctsys.h>
#include <pcbnew.h>
#include <drc.h>
#include <tools/drc.h>
#include <class_marker_pcb.h>
#include <class_board.h>
#include <dialog_drc_base.h>

View File

@ -29,7 +29,7 @@
#include <wx/htmllbox.h>
#include <fctsys.h>
#include <pcbnew.h>
#include <drc.h>
#include <tools/drc.h>
#include <class_marker_pcb.h>
#include <class_board.h>
#include <dialog_drc_base.h>

View File

@ -49,7 +49,7 @@
#include <dialog_netlist.h>
#include <wx_html_report_panel.h>
#include <drc.h>
#include <tools/drc.h>
#define NETLIST_FILTER_MESSAGES_KEY wxT("NetlistReportFilterMsg")
#define NETLIST_UPDATEFOOTPRINTS_KEY wxT("NetlistUpdateFootprints")

View File

@ -30,12 +30,13 @@
#include <gerber_jobfile_writer.h>
#include <reporter.h>
#include <wildcards_and_files_ext.h>
#include <tool/tool_manager.h>
#include <bitmaps.h>
#include <class_board.h>
#include <dialog_plot.h>
#include <dialog_gendrill.h>
#include <wx_html_report_panel.h>
#include <drc.h>
#include <tools/drc.h>
DIALOG_PLOT::DIALOG_PLOT( PCB_EDIT_FRAME* aParent ) :
@ -863,12 +864,14 @@ void DIALOG_PLOT::onRunDRC( wxCommandEvent& event )
if( parent )
{
DRC* drcTool = parent->GetToolManager()->GetTool<DRC>();
// First close an existing dialog if open
// (low probability, but can happen)
parent->GetDrcController()->DestroyDRCDialog( wxID_OK );
drcTool->DestroyDRCDialog( wxID_OK );
// Open a new drc dialod, with the right parent frame, and in Modal Mode
parent->GetDrcController()->ShowDRCDialog( this );
drcTool->ShowDRCDialog( this );
}
}

View File

@ -25,7 +25,7 @@
#include <fctsys.h>
#include <kicad_string.h>
#include <pcbnew.h>
#include <pcb_edit_frame.h>
#include <tools/pcb_editor_control.h>
#include <class_board.h>
#include <dialog_select_net_from_list_base.h>
#include <eda_pattern_match.h>
@ -76,9 +76,9 @@ private:
};
void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
int PCB_EDITOR_CONTROL::ListNets( const TOOL_EVENT& aEvent )
{
DIALOG_SELECT_NET_FROM_LIST dlg( this );
DIALOG_SELECT_NET_FROM_LIST dlg( m_frame );
wxString netname;
if( dlg.ShowModal() == wxID_CANCEL )
@ -86,6 +86,8 @@ void PCB_EDIT_FRAME::ListNetsAndSelect( wxCommandEvent& event )
// Clear highlight
dlg.HighlightNet( "" );
}
return 0;
}

View File

@ -1,7 +1,3 @@
/**
* @file pcbnew/dialogs/dialog_update_pcb.h
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*

View File

@ -31,7 +31,7 @@
#include <drc/courtyard_overlap.h>
#include <class_module.h>
#include <drc.h>
#include <tools/drc.h>
#include <drc/drc_marker_factory.h>

View File

@ -35,7 +35,7 @@
#include <class_track.h>
#include <class_zone.h>
#include <common.h>
#include <drc.h>
#include <tools/drc.h>
#include <fctsys.h>
#include <geometry/geometry_utils.h>
#include <pcb_edit_frame.h>

View File

@ -27,7 +27,7 @@
#include <common.h>
#include <pcbnew.h>
#include <drc.h>
#include <tools/drc.h>
#include <drc_item.h>
#include <class_board.h>
#include <base_units.h>

View File

@ -143,12 +143,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
InstallPcbGlobalDeleteFrame( wxDefaultPosition );
break;
case ID_DRC_CONTROL:
// Shows the DRC dialog in non modal mode, to allows board editing
// with the DRC dialog opened and showing errors.
m_drc->ShowDRCDialog();
break;
case ID_GET_NETLIST:
InstallNetlistFrame();
break;
@ -168,14 +162,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Clean_Pcb();
break;
case ID_MENU_PCB_UPDATE_FOOTPRINTS:
InstallExchangeModuleFrame( nullptr, true, false );
break;
case ID_MENU_PCB_EXCHANGE_FOOTPRINTS:
InstallExchangeModuleFrame( nullptr, false, false );
break;
case ID_MENU_PCB_SWAP_LAYERS:
Swap_Layers( event );
break;

View File

@ -29,7 +29,7 @@
#include <class_board.h>
#include <class_track.h>
#include <pcbnew.h>
#include <drc.h>
#include <tools/drc.h>
int PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,

View File

@ -204,6 +204,10 @@ static EDA_HOTKEY HkZoneFillOrRefill( _HKI( "Fill or Refill All Zones" ),
HK_ZONE_FILL_OR_REFILL, 'B' );
static EDA_HOTKEY HkZoneRemoveFilled( _HKI( "Remove Filled Areas in All Zones" ),
HK_ZONE_REMOVE_FILLED, 'B' + GR_KB_CTRL );
static EDA_HOTKEY HkUpdatePcbFromSch( _HKI( "Update PCB from Schematic" ),
HK_UPDATE_PCB_FROM_SCH, WXK_F8 );
/* Fit on Screen */
#if !defined( __WXMAC__ )
static EDA_HOTKEY HkZoomAuto( _HKI( "Zoom Auto" ), HK_ZOOM_AUTO, WXK_HOME );
@ -450,6 +454,7 @@ EDA_HOTKEY* board_edit_Hotkey_List[] =
&HkEditBoardItem,
&HkEditWithModedit,
&HkUpdatePcbFromSch,
// Active Layer
&HkSwitch2ComponentLayer,

View File

@ -42,13 +42,6 @@
#include "pcbnew_id.h"
// Build the route menu
static void prepareRouteMenu( wxMenu* aParentMenu );
// Build the tools menu
static void prepareToolsMenu( wxMenu* aParentMenu );
void PCB_EDIT_FRAME::ReCreateMenuBar()
{
SELECTION_TOOL* selTool = m_toolManager->GetTool<SELECTION_TOOL>();
@ -86,6 +79,13 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
fileMenu->AddItem( ACTIONS::doNew, SELECTION_CONDITIONS::ShowAlways );
fileMenu->AddItem( ACTIONS::open, SELECTION_CONDITIONS::ShowAlways );
fileMenu->AddMenu( openRecentMenu, SELECTION_CONDITIONS::ShowAlways );
fileMenu->AddItem( PCB_ACTIONS::appendBoard, SELECTION_CONDITIONS::ShowAlways );
fileMenu->AddItem( ID_IMPORT_NON_KICAD_BOARD,
_( "Import Non-KiCad Board File..." ),
_( "Import board file from other applications" ),
import_brd_file_xpm, SELECTION_CONDITIONS::ShowAlways );
fileMenu->AddSeparator();
}
@ -106,22 +106,11 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Clear board and get last rescue file automatically saved by Pcbnew" ),
rescue_xpm, SELECTION_CONDITIONS::ShowAlways );
if( Kiface().IsSingle() ) // not when under a project mgr
{
fileMenu->AddItem( PCB_ACTIONS::appendBoard, SELECTION_CONDITIONS::ShowAlways );
fileMenu->AddItem( ID_IMPORT_NON_KICAD_BOARD,
_( "Import Non-KiCad Board File..." ),
_( "Import board file from other applications" ),
import_brd_file_xpm, SELECTION_CONDITIONS::ShowAlways );
}
fileMenu->AddItem( ID_MENU_READ_BOARD_BACKUP_FILE,
_( "Revert to Last Backup" ),
_( "Clear board and get previous backup version of board" ),
undo_xpm, SELECTION_CONDITIONS::ShowAlways );
fileMenu->AddSeparator();
// Import submenu
ACTION_MENU* submenuImport = new ACTION_MENU();
submenuImport->SetTool( selTool );
@ -135,6 +124,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
submenuImport->Add( _( "Graphics..." ), _( "Import 2D drawing file" ),
ID_GEN_IMPORT_GRAPHICS_FILE, import_vector_xpm );
fileMenu->AddSeparator();
fileMenu->AddMenu( submenuImport, SELECTION_CONDITIONS::ShowAlways );
// Export submenu
@ -261,7 +251,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
editMenu->AddItem( ID_MENU_PCB_EDIT_TEXT_AND_GRAPHICS,
_( "Edit Text && Graphic Properties..." ), "",
reset_text_xpm, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( PCB_ACTIONS::exchangeFootprints, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( PCB_ACTIONS::changeFootprints, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( ID_MENU_PCB_SWAP_LAYERS,
_( "Swap Layers..." ),
_( "Move tracks or drawings from a layer to another layer" ),
@ -455,33 +445,95 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
//-- Route Menu ----------------------------------------------------------
//
wxMenu* routeMenu = new wxMenu;
prepareRouteMenu( routeMenu );
CONDITIONAL_MENU* routeMenu = new CONDITIONAL_MENU( false, selTool );
routeMenu->AddItem( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
_( "Set &Layer Pair..." ), _( "Change active layer pair" ),
select_layer_pair_xpm, SELECTION_CONDITIONS::ShowAlways );
routeMenu->AddSeparator();
routeMenu->AddItem( ID_TRACK_BUTT,
AddHotkeyName( _( "&Single Track" ), g_Board_Editor_Hotkeys_Descr,
HK_ADD_NEW_TRACK, IS_ACCELERATOR ),
_( "Interactively route single track" ),
add_tracks_xpm, SELECTION_CONDITIONS::ShowAlways );
routeMenu->AddItem( ID_DIFF_PAIR_BUTT,
AddHotkeyName( _( "&Differential Pair" ), g_Board_Editor_Hotkeys_Descr,
HK_ROUTE_DIFF_PAIR, IS_ACCELERATOR ),
_( "Interactively route differential pair" ),
ps_diff_pair_xpm, SELECTION_CONDITIONS::ShowAlways );
routeMenu->AddSeparator();
routeMenu->AddItem( ID_TUNE_SINGLE_TRACK_LEN_BUTT,
AddHotkeyName( _( "&Tune Track Length" ), g_Board_Editor_Hotkeys_Descr,
HK_ROUTE_TUNE_SINGLE, IS_ACCELERATOR ),
_( "Tune length of single track" ),
ps_tune_length_xpm, SELECTION_CONDITIONS::ShowAlways );
routeMenu->AddItem( ID_TUNE_DIFF_PAIR_LEN_BUTT,
AddHotkeyName( _( "Tune Differential Pair &Length" ), g_Board_Editor_Hotkeys_Descr,
HK_ROUTE_TUNE_DIFF_PAIR, IS_ACCELERATOR ),
_( "Tune length of differential pair" ),
ps_diff_pair_tune_length_xpm, SELECTION_CONDITIONS::ShowAlways );
routeMenu->AddItem( ID_TUNE_DIFF_PAIR_SKEW_BUTT,
AddHotkeyName( _( "Tune Differential Pair S&kew/Phase" ), g_Board_Editor_Hotkeys_Descr,
HK_ROUTE_TUNE_SKEW, IS_ACCELERATOR ),
_( "Tune skew/phase of a differential pair" ),
ps_diff_pair_tune_phase_xpm, SELECTION_CONDITIONS::ShowAlways );
routeMenu->AddSeparator();
routeMenu->AddItem( ID_MENU_INTERACTIVE_ROUTER_SETTINGS,
_( "&Interactive Router Settings..." ),
_( "Configure interactive router" ),
tools_xpm, SELECTION_CONDITIONS::ShowAlways );
//-- Inspect Menu --------------------------------------------------------
//
wxMenu* inspectMenu = new wxMenu;
CONDITIONAL_MENU* inspectMenu = new CONDITIONAL_MENU( false, selTool );
AddMenuItem( inspectMenu, ID_MENU_LIST_NETS,
_( "&List Nets" ),
_( "View list of nets with names and IDs" ),
KiBitmap( list_nets_xpm ) );
inspectMenu->AddItem( PCB_ACTIONS::listNets, SELECTION_CONDITIONS::ShowAlways );
inspectMenu->AddItem( ACTIONS::measureTool, SELECTION_CONDITIONS::ShowAlways );
AddMenuItem( inspectMenu, ID_PCB_MEASUREMENT_TOOL,
AddHotkeyName( _( "&Measure" ), g_Board_Editor_Hotkeys_Descr, HK_MEASURE_TOOL ),
_( "Measure distance" ),
KiBitmap( measurement_xpm ) );
inspectMenu->AddSeparator();
inspectMenu->AddItem( PCB_ACTIONS::runDRC, SELECTION_CONDITIONS::ShowAlways );
inspectMenu->AppendSeparator();
AddMenuItem( inspectMenu, ID_DRC_CONTROL,
_( "&Design Rules Checker" ),
_( "Perform design rules check" ),
KiBitmap( erc_xpm ) );
inspectMenu->Resolve();
//-- Tools menu ----------------------------------------------------------
//
wxMenu* toolsMenu = new wxMenu;
prepareToolsMenu( toolsMenu );
CONDITIONAL_MENU* toolsMenu = new CONDITIONAL_MENU( false, selTool );
toolsMenu->AddItem( ACTIONS::updatePcbFromSchematic, SELECTION_CONDITIONS::ShowAlways );
toolsMenu->AddItem( PCB_ACTIONS::updateFootprints, SELECTION_CONDITIONS::ShowAlways );
#if defined(KICAD_SCRIPTING_WXPYTHON)
auto pythonConsoleShownCondition = [] ( const SELECTION& aSel ) {
wxMiniFrame* pythonConsole = (wxMiniFrame *) PCB_EDIT_FRAME::findPythonConsole();
return pythonConsole && pythonConsole->IsShown();
};
toolsMenu->AddSeparator();
toolsMenu->AddCheckItem( PCB_ACTIONS::showPythonConsole, pythonConsoleShownCondition );
#endif
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
ACTION_MENU* submenuActionPlugins = new ACTION_MENU();
submenuActionPlugins->SetTool( selTool );
submenuActionPlugins->SetTitle( _( "External Plugins" ) );
submenuActionPlugins->SetIcon( hammer_xpm );
submenuActionPlugins->Add( _( "Refresh Plugins" ),
_( "Reload all python plugins and refresh plugin menus" ),
ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH, reload_xpm );
submenuActionPlugins->AppendSeparator();
toolsMenu->AddSeparator();
toolsMenu->AddMenu( submenuActionPlugins, SELECTION_CONDITIONS::ShowAlways );
#endif
toolsMenu->Resolve();
//-- Preferences menu ----------------------------------------------------
//
@ -494,18 +546,19 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
return GetGalCanvas()->GetBackend() == EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO;
};
prefsMenu->AddItem( ACTIONS::configurePaths, SELECTION_CONDITIONS::ShowAlways );
prefsMenu->AddItem( ACTIONS::showFootprintLibTable, SELECTION_CONDITIONS::ShowAlways );
prefsMenu->AddItem( ACTIONS::configurePaths, SELECTION_CONDITIONS::ShowAlways );
prefsMenu->AddItem( ACTIONS::showFootprintLibTable, SELECTION_CONDITIONS::ShowAlways );
#ifdef BUILD_GITHUB_PLUGIN
prefsMenu->AddItem( ID_PCB_3DSHAPELIB_WIZARD, _( "Add &3D Shapes Libraries Wizard..." ),
prefsMenu->AddItem( ID_PCB_3DSHAPELIB_WIZARD,
_( "Add &3D Shapes Libraries Wizard..." ),
_( "Download 3D shape libraries from GitHub" ),
import3d_xpm, SELECTION_CONDITIONS::ShowAlways );
import3d_xpm, SELECTION_CONDITIONS::ShowAlways );
#endif
prefsMenu->AddItem( wxID_PREFERENCES,
AddHotkeyName( _( "Preferences..." ), g_Module_Editor_Hotkeys_Descr, HK_PREFERENCES ),
_( "Show preferences for all open tools" ),
preference_xpm, SELECTION_CONDITIONS::ShowAlways );
preference_xpm, SELECTION_CONDITIONS::ShowAlways );
prefsMenu->AddSeparator();
Pgm().AddMenuLanguageList( prefsMenu );
@ -533,112 +586,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
// Populate the Action Plugin sub-menu
RebuildActionPluginMenus();
buildActionPluginMenus( submenuActionPlugins );
#endif
}
// Build the route menu
void prepareRouteMenu( wxMenu* aParentMenu )
{
wxString text;
AddMenuItem( aParentMenu, ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR,
_( "Set &Layer Pair..." ), _( "Change active layer pair" ),
KiBitmap( select_layer_pair_xpm ) );
aParentMenu->AppendSeparator();
text = AddHotkeyName( _( "&Single Track" ), g_Board_Editor_Hotkeys_Descr,
HK_ADD_NEW_TRACK, IS_ACCELERATOR );
AddMenuItem( aParentMenu, ID_TRACK_BUTT, text,
_( "Interactively route single track" ),
KiBitmap( add_tracks_xpm ) );
text = AddHotkeyName( _( "&Differential Pair" ), g_Board_Editor_Hotkeys_Descr,
HK_ROUTE_DIFF_PAIR, IS_ACCELERATOR );
AddMenuItem( aParentMenu, ID_DIFF_PAIR_BUTT, text,
_( "Interactively route differential pair" ),
KiBitmap( ps_diff_pair_xpm ) );
aParentMenu->AppendSeparator();
text = AddHotkeyName( _( "&Tune Track Length" ), g_Board_Editor_Hotkeys_Descr,
HK_ROUTE_TUNE_SINGLE, IS_ACCELERATOR );
AddMenuItem( aParentMenu, ID_TUNE_SINGLE_TRACK_LEN_BUTT, text,
_( "Tune length of single track" ),
KiBitmap( ps_tune_length_xpm ) );
text = AddHotkeyName( _( "Tune Differential Pair &Length" ), g_Board_Editor_Hotkeys_Descr,
HK_ROUTE_TUNE_DIFF_PAIR, IS_ACCELERATOR );
AddMenuItem( aParentMenu, ID_TUNE_DIFF_PAIR_LEN_BUTT, text,
_( "Tune length of differential pair" ),
KiBitmap( ps_diff_pair_tune_length_xpm ) );
text = AddHotkeyName( _( "Tune Differential Pair S&kew/Phase" ), g_Board_Editor_Hotkeys_Descr,
HK_ROUTE_TUNE_SKEW, IS_ACCELERATOR );
AddMenuItem( aParentMenu, ID_TUNE_DIFF_PAIR_SKEW_BUTT, text,
_( "Tune skew/phase of a differential pair" ),
KiBitmap( ps_diff_pair_tune_phase_xpm ) );
aParentMenu->AppendSeparator();
AddMenuItem( aParentMenu, ID_MENU_INTERACTIVE_ROUTER_SETTINGS,
_( "&Interactive Router Settings..." ),
_( "Configure interactive router" ),
KiBitmap( tools_xpm ) );
}
// Build the tools menu
void prepareToolsMenu( wxMenu* aParentMenu )
{
AddMenuItem( aParentMenu,
ID_UPDATE_PCB_FROM_SCH,
_( "Update &PCB from Schematic..." ),
_( "Update PCB design with current schematic (forward annotation)" ),
KiBitmap( update_pcb_from_sch_xpm ) );
AddMenuItem( aParentMenu, ID_MENU_PCB_UPDATE_FOOTPRINTS,
_( "Update &Footprints from Library..." ),
_( "Update footprints to include any changes from the library" ),
KiBitmap( reload_xpm ) );
bool needsSeparator = true;
#if defined(KICAD_SCRIPTING_WXPYTHON)
if( needsSeparator )
{
aParentMenu->AppendSeparator();
needsSeparator = false;
}
AddMenuItem( aParentMenu, ID_TOOLBARH_PCB_SCRIPTING_CONSOLE,
_( "&Scripting Console" ),
_( "Show/Hide the Python scripting console" ),
KiBitmap( py_script_xpm ) );
#endif
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
if( needsSeparator )
{
aParentMenu->AppendSeparator();
needsSeparator = false;
}
wxMenu* submenuActionPluginsMenu = new wxMenu();
AddMenuItem( aParentMenu, submenuActionPluginsMenu, ID_TOOLBARH_PCB_ACTION_PLUGIN,
_( "&External Plugins..." ),
_( "Execute or reload python action plugins" ),
KiBitmap( hammer_xpm ) );
AddMenuItem( submenuActionPluginsMenu, ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH,
_( "&Refresh Plugins" ),
_( "Reload all python plugins and refresh plugin menus" ),
KiBitmap( reload_xpm ) );
submenuActionPluginsMenu->AppendSeparator();
#endif
}

View File

@ -133,48 +133,6 @@ void PCB_EDIT_FRAME::OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater,
}
MODULE* PCB_EDIT_FRAME::ListAndSelectModuleName()
{
if( GetBoard()->Modules().empty() )
{
DisplayError( this, _( "No footprints" ) );
return 0;
}
wxArrayString listnames;
for( auto module : GetBoard()->Modules() )
listnames.Add( module->GetReference() );
wxArrayString headers;
headers.Add( wxT( "Module" ) );
std::vector<wxArrayString> itemsToDisplay;
// Conversion from wxArrayString to vector of ArrayString
for( unsigned i = 0; i < listnames.GetCount(); i++ )
{
wxArrayString item;
item.Add( listnames[i] );
itemsToDisplay.push_back( item );
}
EDA_LIST_DIALOG dlg( this, _( "Components" ), headers, itemsToDisplay, wxEmptyString );
if( dlg.ShowModal() != wxID_OK )
return nullptr;
wxString ref = dlg.GetTextSelection();
for( auto module : GetBoard()->Modules() )
{
if( module->GetReference() == ref )
return module;
}
return nullptr;
}
#define ALLOW_PARTIAL_FPID 1
void PCB_EDIT_FRAME::LoadFootprints( NETLIST& aNetlist, REPORTER& aReporter )

View File

@ -33,7 +33,7 @@
#include <trace_helpers.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
#include <drc.h>
#include <tools/drc.h>
#include <layer_widget.h>
#include <pcb_layer_widget.h>
#include <hotkeys.h>
@ -41,10 +41,9 @@
#include <footprint_edit_frame.h>
#include <dialog_helpers.h>
#include <dialog_plot.h>
#include <dialog_exchange_footprints.h>
#include <dialog_edit_footprint_for_BoardEditor.h>
#include <dialogs/dialog_exchange_footprints.h>
#include <dialog_board_setup.h>
#include <dialog_update_pcb.h>
#include <convert_to_biu.h>
#include <view/view.h>
#include <view/view_controls.h>
@ -91,8 +90,6 @@
#if defined(KICAD_SCRIPTING) || defined(KICAD_SCRIPTING_WXPYTHON)
#include <python_scripting.h>
#include <tool/common_tools.h>
#endif
@ -165,12 +162,9 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, PCB_EDIT_FRAME::RecreateBOMFileFromBoard )
// menu Miscellaneous
EVT_MENU( ID_MENU_LIST_NETS, PCB_EDIT_FRAME::ListNetsAndSelect )
EVT_MENU( ID_PCB_EDIT_TRACKS_AND_VIAS, PCB_EDIT_FRAME::OnEditTracksAndVias )
EVT_MENU( ID_PCB_GLOBAL_DELETE, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_CLEAN, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_UPDATE_FOOTPRINTS, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_EXCHANGE_FOOTPRINTS, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_EDIT_TEXT_AND_GRAPHICS, PCB_EDIT_FRAME::OnEditTextAndGraphics )
@ -181,7 +175,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_RUN_LIBRARY, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_GEN_PLOT_SVG, PCB_EDIT_FRAME::ExportSVG )
EVT_TOOL( ID_GET_NETLIST, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_DRC_CONTROL, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
EVT_COMBOBOX( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::Process_Special_Functions )
@ -193,18 +186,10 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH, PCB_EDIT_FRAME::OnActionPluginRefresh )
#endif
#if defined( KICAD_SCRIPTING_WXPYTHON )
// has meaning only with KICAD_SCRIPTING_WXPYTHON enabled
EVT_TOOL( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, PCB_EDIT_FRAME::ScriptingConsoleEnableDisable )
EVT_UPDATE_UI( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE,
PCB_EDIT_FRAME::OnUpdateScriptingConsoleState )
#endif
// Option toolbar
EVT_TOOL( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_TOOL( ID_UPDATE_PCB_FROM_SCH, PCB_EDIT_FRAME::OnUpdatePCBFromSch )
EVT_TOOL( ID_RUN_EESCHEMA, PCB_EDIT_FRAME::OnRunEeschema )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
@ -280,8 +265,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
// Create the PCB_LAYER_WIDGET *after* SetBoard():
m_Layers = new PCB_LAYER_WIDGET( this, GetGalCanvas() );
m_drc = new DRC( this ); // these 2 objects point to each other
wxIcon icon;
icon.CopyFromBitmap( KiBitmap( icon_pcbnew_xpm ) );
SetIcon( icon );
@ -413,7 +396,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
PCB_EDIT_FRAME::~PCB_EDIT_FRAME()
{
delete m_drc;
}
@ -498,6 +480,7 @@ void PCB_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new POSITION_RELATIVE_TOOL );
m_toolManager->RegisterTool( new ZONE_FILLER_TOOL );
m_toolManager->RegisterTool( new AUTOPLACE_TOOL );
m_toolManager->RegisterTool( new DRC );
m_toolManager->InitTools();
// Run the selection tool, it is supposed to be always active
@ -704,27 +687,6 @@ void PCB_EDIT_FRAME::SetGridColor( COLOR4D aColor )
}
bool PCB_EDIT_FRAME::IsMicroViaAcceptable()
{
int copperlayercnt = GetBoard()->GetCopperLayerCount( );
PCB_LAYER_ID currLayer = GetActiveLayer();
if( !GetDesignSettings().m_MicroViasAllowed )
return false; // Obvious..
if( copperlayercnt < 4 )
return false; // Only on multilayer boards..
if( ( currLayer == B_Cu )
|| ( currLayer == F_Cu )
|| ( currLayer == copperlayercnt - 2 )
|| ( currLayer == In1_Cu ) )
return true;
return false;
}
void PCB_EDIT_FRAME::SetActiveLayer( PCB_LAYER_ID aLayer )
{
PCB_BASE_FRAME::SetActiveLayer( aLayer );
@ -935,9 +897,8 @@ void PCB_EDIT_FRAME::UpdateUserInterface()
#if defined( KICAD_SCRIPTING_WXPYTHON )
void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable( wxCommandEvent& aEvent )
void PCB_EDIT_FRAME::ScriptingConsoleEnableDisable()
{
wxWindow * pythonPanelFrame = findPythonConsole();
bool pythonPanelShown = true;
@ -1017,15 +978,6 @@ bool PCB_EDIT_FRAME::SetCurrentNetClass( const wxString& aNetClassName )
}
void PCB_EDIT_FRAME::OnUpdatePCBFromSch( wxCommandEvent& event )
{
NETLIST netlist;
if( FetchNetlistFromSchematic( netlist, ANNOTATION_DIALOG ) )
UpdatePCBFromNetlist( netlist );
}
bool PCB_EDIT_FRAME::FetchNetlistFromSchematic( NETLIST& aNetlist, FETCH_NETLIST_MODE aMode )
{
if( Kiface().IsSingle() )
@ -1079,19 +1031,6 @@ bool PCB_EDIT_FRAME::FetchNetlistFromSchematic( NETLIST& aNetlist, FETCH_NETLIST
}
void PCB_EDIT_FRAME::UpdatePCBFromNetlist( NETLIST& aNetlist )
{
DIALOG_UPDATE_PCB updateDialog( this, &aNetlist );
updateDialog.ShowModal();
auto selectionTool = static_cast<SELECTION_TOOL*>(
m_toolManager->FindTool( "pcbnew.InteractiveSelection" ) );
if( !selectionTool->GetSelection().Empty() )
GetToolManager()->InvokeTool( "pcbnew.InteractiveEdit" );
}
void PCB_EDIT_FRAME::DoUpdatePCBFromNetlist( NETLIST& aNetlist, bool aUseTimestamps )
{
BOARD_NETLIST_UPDATER updater( this, GetBoard() );
@ -1189,7 +1128,7 @@ void PCB_EDIT_FRAME::PythonPluginsReload()
#if defined(KICAD_SCRIPTING_ACTION_MENU)
// Action plugins can be modified, therefore the plugins menu
// must be updated:
RebuildActionPluginMenus();
ReCreateMenuBar();
// Recreate top toolbar to add action plugin buttons
ReCreateHToolbar();
#endif

View File

@ -59,6 +59,7 @@ struct PARSE_ERROR;
class IO_ERROR;
class FP_LIB_TABLE;
class BOARD_NETLIST_UPDATER;
class ACTION_MENU;
namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
@ -91,8 +92,6 @@ class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
protected:
PCB_LAYER_WIDGET* m_Layers;
DRC* m_drc; ///< the DRC controller, see drc.cpp
PARAM_CFG_ARRAY m_configParams; ///< List of Pcbnew configuration settings.
wxString m_lastNetListRead; ///< Last net list read with relative path.
@ -110,10 +109,10 @@ protected:
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
/**
* Function RebuildActionPluginMenus
* Function buildActionPluginMenus
* Fill action menu with all registered action plugins
*/
void RebuildActionPluginMenus();
void buildActionPluginMenus( ACTION_MENU* aActionMenu );
/**
* Function AddActionPluginTools
@ -209,19 +208,13 @@ protected:
*
* @return true if the auto save was successful.
*/
virtual bool doAutoSave() override;
bool doAutoSave() override;
/**
* Function isautoSaveRequired
* returns true if the board has been modified.
*/
virtual bool isAutoSaveRequired() const override;
/**
* Function moveExact
* Move the selected item exactly
*/
void moveExact();
bool isAutoSaveRequired() const override;
/**
* Load the given filename but sets the path to the current project path.
@ -287,7 +280,7 @@ public:
* this is a virtual function called by EDA_DRAW_FRAME::OnSockRequest().
* @param cmdline = received command from socket
*/
virtual void ExecuteRemoteCommand( const char* cmdline ) override;
void ExecuteRemoteCommand( const char* cmdline ) override;
void KiwayMailIn( KIWAY_EXPRESS& aEvent ) override;
@ -297,12 +290,6 @@ public:
*/
void ToPlotter( wxCommandEvent& event );
/**
* Function ToPrinter
* Install the print dialog.
*/
void ToPrinter( wxCommandEvent& event );
/**
* Function SVG_Print
* Shows the Export to SVG file dialog.
@ -310,7 +297,6 @@ public:
void ExportSVG( wxCommandEvent& event );
// User interface update command event handlers.
void OnUpdateSave( wxUpdateUIEvent& aEvent );
void OnUpdateLayerPair( wxUpdateUIEvent& aEvent );
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
bool LayerManagerShown();
@ -320,17 +306,16 @@ public:
void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent );
void OnLayerColorChange( wxCommandEvent& aEvent );
void OnUpdatePCBFromSch( wxCommandEvent& event );
void OnRunEeschema( wxCommandEvent& event );
void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, const bool aEdit = true );
void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, const bool aEdit = true );
void UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, bool aEdit = true );
void UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool aEdit = true );
/**
* Function IsGridVisible() , virtual
* @return true if the grid must be shown
*/
virtual bool IsGridVisible() const override;
bool IsGridVisible() const override;
/**
* Function SetGridVisibility() , virtual
@ -338,19 +323,19 @@ public:
* if you want to store/retrieve the grid visibility in configuration.
* @param aVisible = true if the grid must be shown
*/
virtual void SetGridVisibility( bool aVisible ) override;
void SetGridVisibility( bool aVisible ) override;
/**
* Function GetGridColor() , virtual
* @return the color of the grid
*/
virtual COLOR4D GetGridColor() override;
COLOR4D GetGridColor() override;
/**
* Function SetGridColor() , virtual
* @param aColor = the new color of the grid
*/
virtual void SetGridColor( COLOR4D aColor ) override;
void SetGridColor( COLOR4D aColor ) override;
// Configurations:
void Process_Config( wxCommandEvent& event );
@ -514,14 +499,14 @@ public:
* to update auxiliary information.
* </p>
*/
virtual void OnModify() override;
void OnModify() override;
/**
* Function SetActiveLayer
* will change the currently active layer to \a aLayer and also
* update the PCB_LAYER_WIDGET.
*/
virtual void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
void SetActiveLayer( PCB_LAYER_ID aLayer ) override;
PCB_LAYER_WIDGET* GetLayerManager() { return m_Layers; }
@ -667,13 +652,6 @@ public:
*/
bool OpenProjectFiles( const std::vector<wxString>& aFileSet, int aCtl = 0 ) override;
/**
* Function AppendBoardFile
* appends a board file onto the current one, creating God knows what.
* the main purpose is only to allow panelizing boards.
*/
bool AppendBoardFile( const wxString& aFullFileName, int aCtl );
/**
* Function SavePcbFile
* writes the board data structures to \a a aFileName
@ -719,12 +697,6 @@ public:
///> @copydoc PCB_BASE_FRAME::SetPageSettings()
void SetPageSettings( const PAGE_INFO& aPageSettings ) override;
/**
* Function GetDrcController
* @return the DRC controller
*/
DRC* GetDrcController() { return m_drc; }
/**
* Function RecreateBOMFileFromBoard
* Recreates a .cmp file from the current loaded board
@ -813,7 +785,6 @@ public:
*/
void OnExportHyperlynx( wxCommandEvent& event );
/**
* Function Export_IDF3
* Creates an IDF3 compliant BOARD (*.emn) and LIBRARY (*.emp) file.
@ -878,26 +849,8 @@ public:
*/
void ImportSpecctraDesign( wxCommandEvent& event );
/**
* Function ListAndSelectModuleName
* builds and shows a list of existing modules on board that the user can select.
* @return a pointer to the selected module or NULL.
*/
MODULE* ListAndSelectModuleName();
/**
* Function ListNetsAndSelect
* called by a command event
* displays the sorted list of nets in a dialog frame
* If a net is selected, it is highlighted
*/
void ListNetsAndSelect( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event );
// Graphic Segments type DRAWSEGMENT
void Start_Move_DrawItem( DRAWSEGMENT* drawitem, wxDC* DC );
// Footprint editing (see also PCB_BASE_FRAME)
void InstallFootprintPropertiesDialog( MODULE* Module );
@ -926,18 +879,6 @@ public:
*/
void OnEditItemRequest( BOARD_ITEM* aItem ) override;
/**
* Function IsMicroViaAcceptable
* return true if a microvia can be placed on the board.
* <p>
* A microvia is a small via restricted to 2 near neighbor layers
* because its is hole is made by laser which can penetrate only one layer
* It is mainly used to connect BGA to the first inner layer
* And it is allowed from an external layer to the first inner layer
* </p>
*/
bool IsMicroViaAcceptable();
/**
* Function Edit_TrackSegm_Width
* Modify one track segment width or one via diameter (using DRC control).
@ -969,16 +910,6 @@ public:
// zone handling
/**
* Function Fill_Zone
* Calculate the zone filling for the outline zone_container
* The zone outline is a frontier, and can be complex (with holes)
* The filling starts from starting points like pads, tracks.
* If exists the old filling is removed
* @param aZone = zone to fill
*/
void Fill_Zone( ZONE_CONTAINER* aZone );
/**
* Function Fill_All_Zones
*/
@ -991,26 +922,12 @@ public:
*/
void Check_All_Zones( wxWindow* aActiveWindow );
/**
* Function Edit_Zone_Params
* Edit params (layer, clearance, ...) for a zone outline
*/
void Edit_Zone_Params( ZONE_CONTAINER* zone_container );
/**
* Function Delete_Zone
* Remove the zone which include the segment aZone, or the zone which have
* the given time stamp. A zone is a group of segments which have the
* same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param zone_container = zone to modify
* the member .m_CornerSelection is used to find the outline to remove.
* if the outline is the main outline, all the zone is removed
* otherwise, the hole is deleted
*/
void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container );
// Properties dialogs
void ShowTargetOptionsDialog( PCB_TARGET* aTarget );
void ShowDimensionPropertyDialog( DIMENSION* aDimension );
@ -1024,12 +941,6 @@ public:
enum FETCH_NETLIST_MODE { NO_ANNOTATION, QUIET_ANNOTATION, ANNOTATION_DIALOG };
bool FetchNetlistFromSchematic( NETLIST& aNetlist, FETCH_NETLIST_MODE aMode );
/**
* Function UpdatePCBFromNetlist
* @param aNetlist
*/
void UpdatePCBFromNetlist( NETLIST& aNetlist );
/**
* Function DoUpdatePCBFromNetlist
* An automated version of UpdatePCBFromNetlist which skips the UI dialog.
@ -1046,9 +957,7 @@ public:
* @param aReporter is a #REPORTER object to display messages
* @return true if the netlist was read successfully
*/
bool ReadNetlistFromFile( const wxString &aFilename,
NETLIST& aNetlist,
REPORTER& aReporter );
bool ReadNetlistFromFile( const wxString &aFilename, NETLIST& aNetlist, REPORTER& aReporter );
/**
* Called after netlist is updated
@ -1058,19 +967,12 @@ public:
void OnNetlistChanged( BOARD_NETLIST_UPDATER& aUpdater, bool* aRunDragCommand );
// Autoplacement:
void OnPlaceOrRouteFootprints( wxCommandEvent& event );
#if defined( KICAD_SCRIPTING_WXPYTHON )
/**
* Function ScriptingConsoleEnableDisable
* enables or disabled the scripting console
*/
void ScriptingConsoleEnableDisable( wxCommandEvent& aEvent );
void OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent );
void ScriptingConsoleEnableDisable();
#endif
void LockModule( MODULE* aModule, bool aLocked );

View File

@ -118,11 +118,8 @@ enum pcbnew_ids
ID_MENU_RECOVER_BOARD_AUTOSAVE,
ID_MENU_ARCHIVE_MODULES_IN_LIBRARY,
ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES,
ID_MENU_LIST_NETS,
ID_PCB_EDIT_TRACKS_AND_VIAS,
ID_MENU_PCB_CLEAN,
ID_MENU_PCB_UPDATE_FOOTPRINTS,
ID_MENU_PCB_EXCHANGE_FOOTPRINTS,
ID_MENU_PCB_SWAP_LAYERS,
ID_MENU_PCB_EDIT_TEXT_AND_GRAPHICS,
@ -137,8 +134,6 @@ enum pcbnew_ids
ID_GEN_IMPORT_SPECCTRA_DESIGN,
ID_GEN_IMPORT_GRAPHICS_FILE,
ID_TOOLBARH_PCB_SCRIPTING_CONSOLE,
ID_TOOLBARH_PCB_ACTION_PLUGIN,
ID_TOOLBARH_PCB_ACTION_PLUGIN_REFRESH,
@ -164,7 +159,6 @@ enum pcbnew_ids
ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD,
ID_PCB_MUWAVE_END_CMD,
ID_DRC_CONTROL,
ID_PCB_GLOBAL_DELETE,
ID_TOOLBARH_PCB_SELECT_LAYER,
@ -217,7 +211,6 @@ enum pcbnew_ids
ID_FOOTPRINT_WIZARD_RESET_TO_DEFAULT,
ID_ADD_FOOTPRINT_TO_BOARD,
ID_UPDATE_PCB_FROM_SCH,
ID_RUN_EESCHEMA,
ID_PCBNEW_END_LIST
};

View File

@ -38,6 +38,7 @@
#include <class_drawsegment.h>
#include <class_zone.h>
#include <board_commit.h>
#include <tool/action_menu.h>
PYTHON_ACTION_PLUGIN::PYTHON_ACTION_PLUGIN( PyObject* aAction )
{
@ -380,70 +381,22 @@ void PCB_EDIT_FRAME::RunActionPlugin( ACTION_PLUGIN* aActionPlugin )
}
void PCB_EDIT_FRAME::RebuildActionPluginMenus()
void PCB_EDIT_FRAME::buildActionPluginMenus( ACTION_MENU* actionMenu )
{
wxMenu* actionMenu = GetMenuBar()->FindItem( ID_TOOLBARH_PCB_ACTION_PLUGIN )->GetSubMenu();
if( !actionMenu ) // Should not occur.
return;
// First, remove existing submenus, if they are too many
wxMenuItemList list = actionMenu->GetMenuItems();
// The first menuitems are the refresh menu and separator. do not count them
int act_menu_count = -2;
std::vector<wxMenuItem*> available_menus;
for( auto iter = list.begin(); iter != list.end(); ++iter, act_menu_count++ )
{
if( act_menu_count < 0 )
continue;
wxMenuItem* item = *iter;
if( act_menu_count < ACTION_PLUGINS::GetActionsCount() )
{
available_menus.push_back( item );
continue;
}
// Remove menus which are not usable for our current plugin list
Disconnect( item->GetId(), wxEVT_COMMAND_MENU_SELECTED,
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &
PCB_EDIT_FRAME::OnActionPluginMenu );
actionMenu->Delete( item );
}
for( int ii = 0; ii < ACTION_PLUGINS::GetActionsCount(); ii++ )
{
wxMenuItem* item;
ACTION_PLUGIN* ap = ACTION_PLUGINS::GetAction( ii );
const wxBitmap& bitmap = ap->iconBitmap.IsOk() ? ap->iconBitmap : KiBitmap( hammer_xpm );
if( ii < (int) available_menus.size() )
{
item = available_menus[ii];
item->SetItemLabel( ap->GetName() );
item->SetHelp( ap->GetDescription() );
item = AddMenuItem( actionMenu, wxID_ANY, ap->GetName(), ap->GetDescription(), bitmap );
// On windows we need to set "unchecked" bitmap
#if defined(__WXMSW__)
item->SetBitmap( bitmap, false );
#else
item->SetBitmap( bitmap );
#endif
}
else
{
item = AddMenuItem( actionMenu, wxID_ANY,
ap->GetName(),
ap->GetDescription(),
bitmap );
Connect( item->GetId(), wxEVT_COMMAND_MENU_SELECTED,
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &
PCB_EDIT_FRAME::OnActionPluginMenu );
}
Connect( item->GetId(), wxEVT_COMMAND_MENU_SELECTED,
(wxObjectEventFunction) (wxEventFunction) (wxCommandEventFunction) &
PCB_EDIT_FRAME::OnActionPluginMenu );
ACTION_PLUGINS::SetActionMenu( ii, item->GetId() );
}

View File

@ -282,8 +282,8 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
ADD_TOOL( ID_OPEN_MODULE_VIEWER, modview_icon_xpm, _( "Open footprint viewer" ) );
KiScaledSeparator( m_mainToolBar, this );
ADD_TOOL( ID_UPDATE_PCB_FROM_SCH, update_pcb_from_sch_xpm, _( "Update PCB from schematic" ) );
ADD_TOOL( ID_DRC_CONTROL, erc_xpm, _( "Perform design rules check" ) );
m_mainToolBar->Add( ACTIONS::updatePcbFromSchematic );
m_mainToolBar->Add( PCB_ACTIONS::runDRC );
KiScaledSeparator( m_mainToolBar, this );
@ -308,10 +308,7 @@ void PCB_EDIT_FRAME::ReCreateHToolbar()
if( IsWxPythonLoaded() )
{
KiScaledSeparator( m_mainToolBar, this );
m_mainToolBar->AddTool( ID_TOOLBARH_PCB_SCRIPTING_CONSOLE, wxEmptyString,
KiScaledBitmap( py_script_xpm, this ),
_( "Show/Hide the Python Scripting console" ), wxITEM_CHECK );
m_mainToolBar->Add( PCB_ACTIONS::showPythonConsole, ACTION_TOOLBAR::TOGGLE );
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
AddActionPluginTools();
@ -556,7 +553,7 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
}
void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, const bool aEdit )
void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox, bool aEdit )
{
if( aTrackWidthSelectBox == NULL )
return;
@ -600,7 +597,7 @@ void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox,
}
void PCB_EDIT_FRAME::UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, const bool aEdit )
void PCB_EDIT_FRAME::UpdateViaSizeSelectBox( wxChoice* aViaSizeSelectBox, bool aEdit )
{
if( aViaSizeSelectBox == NULL )
return;
@ -730,22 +727,6 @@ void PCB_EDIT_FRAME::OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent )
}
#if defined( KICAD_SCRIPTING_WXPYTHON )
// Used only when the DKICAD_SCRIPTING_WXPYTHON option is on
void PCB_EDIT_FRAME::OnUpdateScriptingConsoleState( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() != m_mainToolBar )
return;
wxMiniFrame* pythonPanelFrame = (wxMiniFrame *) findPythonConsole();
bool pythonPanelShown = pythonPanelFrame ? pythonPanelFrame->IsShown() : false;
aEvent.Check( pythonPanelShown );
}
#endif
bool PCB_EDIT_FRAME::LayerManagerShown()
{
return m_auimgr.GetPane( "LayersManager" ).IsShown();
@ -780,6 +761,13 @@ void PCB_EDIT_FRAME::SyncMenusAndToolbars()
m_mainToolBar->Toggle( ACTIONS::undo, GetScreen() && GetScreen()->GetUndoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::redo, GetScreen() && GetScreen()->GetRedoCommandCount() > 0 );
m_mainToolBar->Toggle( ACTIONS::zoomTool, GetToolId() == ID_ZOOM_SELECTION );
#if defined(KICAD_SCRIPTING_WXPYTHON)
if( IsWxPythonLoaded() )
{
wxMiniFrame* console = (wxMiniFrame *) PCB_EDIT_FRAME::findPythonConsole();
m_mainToolBar->Toggle( PCB_ACTIONS::showPythonConsole, console && console->IsShown() );
}
#endif
m_mainToolBar->Refresh();
m_optionsToolBar->Toggle( ACTIONS::toggleGrid, IsGridVisible() );

View File

@ -23,10 +23,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file drc.cpp
*/
#include <fctsys.h>
#include <pcb_edit_frame.h>
#include <trigo.h>
@ -45,13 +41,13 @@
#include <geometry/geometry_utils.h>
#include <connectivity/connectivity_data.h>
#include <connectivity/connectivity_algo.h>
#include <bitmaps.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/pcb_tool_base.h>
#include <kiface_i.h>
#include <pcbnew.h>
#include <drc.h>
#include <tools/drc.h>
#include <pcb_netlist.h>
#include <dialog_drc.h>
@ -62,13 +58,79 @@
#include <drc/courtyard_overlap.h>
TOOL_ACTION PCB_ACTIONS::runDRC( "pcbnew.DRCTool.runDRC",
AS_GLOBAL, 0,
_( "Design Rules Checker" ), _( "Show the design rules checker window" ),
erc_xpm );
DRC::DRC() :
PCB_TOOL_BASE( "pcbnew.DRCTool" )
{
m_drcDialog = NULL;
// establish initial values for everything:
m_drcInLegacyRoutingMode = false;
m_doPad2PadTest = true; // enable pad to pad clearance tests
m_doUnconnectedTest = true; // enable unconnected tests
m_doZonesTest = false; // disable zone to items clearance tests
m_doKeepoutTest = true; // enable keepout areas to items clearance tests
m_refillZones = false; // Only fill zones if requested by user.
m_reportAllTrackErrors = false;
m_testFootprints = false;
m_drcRun = false;
m_footprintsTested = false;
m_doCreateRptFile = false;
// m_rptFilename set to empty by its constructor
m_currentMarker = NULL;
m_segmAngle = 0;
m_segmLength = 0;
m_xcliplo = 0;
m_ycliplo = 0;
m_xcliphi = 0;
m_ycliphi = 0;
}
DRC::~DRC()
{
for( DRC_ITEM* unconnectedItem : m_unconnected )
delete unconnectedItem;
for( DRC_ITEM* footprintItem : m_footprints )
delete footprintItem;
}
void DRC::Reset( RESET_REASON aReason )
{
m_pcbEditorFrame = getEditFrame<PCB_EDIT_FRAME>();
if( aReason == MODEL_RELOAD )
{
if( m_drcDialog )
DestroyDRCDialog( wxID_OK );
m_pcb = m_pcbEditorFrame->GetBoard();
m_markerFactory.SetUnitsProvider( [=]() { return m_pcbEditorFrame->GetUserUnits(); } );
}
}
void DRC::ShowDRCDialog( wxWindow* aParent )
{
bool show_dlg_modal = true;
// the dialog needs a parent frame. if it is not specified, this is
// the PCB editor frame specified in DRC class.
if( aParent == NULL )
if( !aParent )
{
// if any parent is specified, the dialog is modal.
// if this is the default PCB editor frame, it is not modal
@ -76,10 +138,8 @@ void DRC::ShowDRCDialog( wxWindow* aParent )
aParent = m_pcbEditorFrame;
}
TOOL_MANAGER* toolMgr = m_pcbEditorFrame->GetToolManager();
toolMgr->RunAction( ACTIONS::cancelInteractive, true );
toolMgr->DeactivateTool();
toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
Activate();
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
if( !m_drcDialog )
{
@ -101,6 +161,13 @@ void DRC::ShowDRCDialog( wxWindow* aParent )
}
int DRC::ShowDRCDialog( const TOOL_EVENT& aEvent )
{
ShowDRCDialog( nullptr );
return 0;
}
void DRC::addMarkerToPcb( MARKER_PCB* aMarker )
{
// In legacy routing mode, do not add markers to the board.
@ -128,102 +195,11 @@ void DRC::DestroyDRCDialog( int aReason )
m_drcDialog->GetRptSettings( &m_doCreateRptFile, m_rptFilename);
m_drcDialog->Destroy();
m_drcDialog = NULL;
m_drcDialog = nullptr;
}
}
DRC::DRC( PCB_EDIT_FRAME* aPcbWindow )
{
m_pcbEditorFrame = aPcbWindow;
m_pcb = aPcbWindow->GetBoard();
m_drcDialog = NULL;
// establish initial values for everything:
m_drcInLegacyRoutingMode = false;
m_doPad2PadTest = true; // enable pad to pad clearance tests
m_doUnconnectedTest = true; // enable unconnected tests
m_doZonesTest = false; // disable zone to items clearance tests
m_doKeepoutTest = true; // enable keepout areas to items clearance tests
m_refillZones = false; // Only fill zones if requested by user.
m_reportAllTrackErrors = false;
m_testFootprints = false;
m_drcRun = false;
m_footprintsTested = false;
m_doCreateRptFile = false;
// m_rptFilename set to empty by its constructor
m_currentMarker = NULL;
m_segmAngle = 0;
m_segmLength = 0;
m_xcliplo = 0;
m_ycliplo = 0;
m_xcliphi = 0;
m_ycliphi = 0;
m_markerFactory.SetUnitsProvider( [=]() { return aPcbWindow->GetUserUnits(); } );
}
DRC::~DRC()
{
for( DRC_ITEM* unconnectedItem : m_unconnected )
delete unconnectedItem;
for( DRC_ITEM* footprintItem : m_footprints )
delete footprintItem;
}
int DRC::DrcOnCreatingTrack( TRACK* aRefSegm, TRACKS& aList )
{
updatePointers();
// Set right options for this on line drc
int drc_state = m_drcInLegacyRoutingMode;
m_drcInLegacyRoutingMode = true;
int rpt_state = m_reportAllTrackErrors;
m_reportAllTrackErrors = false;
// Test new segment against tracks and pads, not against copper zones
if( !doTrackDrc( aRefSegm, aList.begin(), aList.end(), true, false ) )
{
if( m_currentMarker )
{
m_pcbEditorFrame->SetMsgPanel( m_currentMarker );
delete m_currentMarker;
m_currentMarker = nullptr;
}
m_drcInLegacyRoutingMode = drc_state;
m_reportAllTrackErrors = rpt_state;
return BAD_DRC;
}
if( !doTrackKeepoutDrc( aRefSegm ) )
{
if( m_currentMarker )
{
m_pcbEditorFrame->SetMsgPanel( m_currentMarker );
delete m_currentMarker;
m_currentMarker = nullptr;
}
m_drcInLegacyRoutingMode = drc_state;
m_reportAllTrackErrors = rpt_state;
return BAD_DRC;
}
m_drcInLegacyRoutingMode = drc_state;
m_reportAllTrackErrors = rpt_state;
return OK_DRC;
}
int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
{
BOARD* board = m_pcbEditorFrame->GetBoard();
@ -377,33 +353,6 @@ int DRC::TestZoneToZoneOutline( ZONE_CONTAINER* aZone, bool aCreateMarkers )
}
int DRC::DrcOnCreatingZone( ZONE_CONTAINER* aArea, int aCornerIndex )
{
updatePointers();
// Set right options for this on line drc
int drc_state = m_drcInLegacyRoutingMode;
m_drcInLegacyRoutingMode = true;
int rpt_state = m_reportAllTrackErrors;
m_reportAllTrackErrors = false;
if( !doEdgeZoneDrc( aArea, aCornerIndex ) )
{
wxASSERT( m_currentMarker );
m_pcbEditorFrame->SetMsgPanel( m_currentMarker );
delete m_currentMarker;
m_currentMarker = nullptr;
m_drcInLegacyRoutingMode = drc_state;
m_reportAllTrackErrors = rpt_state;
return BAD_DRC;
}
m_drcInLegacyRoutingMode = drc_state;
m_reportAllTrackErrors = rpt_state;
return OK_DRC;
}
void DRC::RunTests( wxTextCtrl* aMessages )
{
// be sure m_pcb is the current board, not a old one
@ -1524,3 +1473,10 @@ void DRC::TestFootprints( NETLIST& aNetlist, BOARD* aPCB, EDA_UNITS_T aUnits,
}
void DRC::setTransitions()
{
Go( &DRC::ShowDRCDialog, PCB_ACTIONS::runDRC.MakeEvent() );
}

View File

@ -35,7 +35,7 @@
#include <geometry/shape_poly_set.h>
#include <memory>
#include <vector>
#include <tools/pcb_tool_base.h>
#include <drc/drc_marker_factory.h>
#define OK_DRC 0
@ -187,10 +187,17 @@ typedef std::vector<DRC_ITEM*> DRC_LIST;
* This class is given access to the windows and the BOARD
* that it needs via its constructor or public access functions.
*/
class DRC
class DRC : public PCB_TOOL_BASE
{
friend class DIALOG_DRC_CONTROL;
public:
DRC();
~DRC();
/// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override;
private:
// protected or private functions() are lowercase first character.
@ -250,6 +257,9 @@ private:
bool m_footprintsTested;
///> Sets up handlers for various events.
void setTransitions() override;
/**
* Update needed pointers from the one pointer which is known not to change.
*/
@ -421,36 +431,6 @@ private:
//-----</single tests>---------------------------------------------
public:
DRC( PCB_EDIT_FRAME* aPcbWindow );
~DRC();
/**
* Function Drc
* tests the current segment and returns the result and displays the error
* in the status panel only if one exists.
* No marker created or added to the board. Must be used only during track
* creation in legacy canvas
* @param aRefSeg The current segment to test.
* @param aList The track list to test (usually m_Pcb->Tracks())
* @return int - BAD_DRC (1) if DRC error or OK_DRC (0) if OK
*/
int DrcOnCreatingTrack( TRACK* aRefSeg, TRACKS& aList );
/**
* Function Drc
* tests the outline segment starting at CornerIndex and returns the result and displays
* the error in the status panel only if one exists.
* Test Edge inside other areas
* Test Edge too close other areas
* No marker created or added to the board. Must be used only during zone
* creation in legacy canvas
* @param aArea The area parent which contains the corner.
* @param aCornerIndex The starting point of the segment to test.
* @return int - BAD_DRC (1) if DRC error or OK_DRC (0) if OK
*/
int DrcOnCreatingZone( ZONE_CONTAINER* aArea, int aCornerIndex );
/**
* Tests whether distance between zones complies with the DRC rules.
*
@ -482,7 +462,9 @@ public:
* The modal mode is mandatory if the dialog is created from another dialog, not
* from the PCB editor frame
*/
void ShowDRCDialog( wxWindow* aParent = NULL );
void ShowDRCDialog( wxWindow* aParent );
int ShowDRCDialog( const TOOL_EVENT& aEvent );
/**
* Deletes this ui dialog box and zeros out its pointer to remember

View File

@ -1,7 +1,3 @@
/**
* @file drc_clearance_test_functions.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
@ -36,7 +32,7 @@
#include <trigo.h>
#include <pcbnew.h>
#include <drc.h>
#include <tools/drc.h>
#include <class_board.h>
#include <class_module.h>

View File

@ -68,7 +68,7 @@ using namespace std::placeholders;
// Edit tool actions
TOOL_ACTION PCB_ACTIONS::editFootprintInFpEditor( "pcbnew.InteractiveEdit.editFootprintInFpEditor",
TOOL_ACTION PCB_ACTIONS::editFootprintInFpEditor( "pcbnew.InteractiveEdit.EditFpInFpEditor",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_MODULE_WITH_MODEDIT ),
_( "Open in Footprint Editor" ),
_( "Opens the selected footprint in the Footprint Editor" ),
@ -134,16 +134,28 @@ TOOL_ACTION PCB_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt",
_( "Delete Full Track" ), _( "Deletes selected item(s) and copper connections" ),
delete_xpm, AF_NONE, (void*) REMOVE_FLAGS::ALT );
TOOL_ACTION PCB_ACTIONS::updateFootprints( "pcbnew.InteractiveEdit.updateFootprints",
TOOL_ACTION PCB_ACTIONS::updateFootprint( "pcbnew.InteractiveEdit.updateFootprint",
AS_GLOBAL, 0,
_( "Update Footprint..." ), _( "Update the footprint from the library" ),
_( "Update Footprint..." ),
_( "Update footprint to include any changes from the library" ),
reload_xpm );
TOOL_ACTION PCB_ACTIONS::exchangeFootprints( "pcbnew.InteractiveEdit.ExchangeFootprints",
TOOL_ACTION PCB_ACTIONS::updateFootprints( "pcbnew.InteractiveEdit.updateFootprints",
AS_GLOBAL, 0,
_( "Update Footprints from Library..." ),
_( "Update footprints to include any changes from the library" ),
reload_xpm );
TOOL_ACTION PCB_ACTIONS::changeFootprint( "pcbnew.InteractiveEdit.changeFootprint",
AS_GLOBAL, 0,
_( "Change Footprint..." ), _( "Assign a different footprint from the library" ),
exchange_xpm );
TOOL_ACTION PCB_ACTIONS::changeFootprints( "pcbnew.InteractiveEdit.changeFootprints",
AS_GLOBAL, 0,
_( "Change Footprints..." ), _( "Assign different footprints from the library" ),
exchange_xpm );
TOOL_ACTION PCB_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_ITEM ),
_( "Properties..." ), _( "Displays item properties dialog" ),
@ -273,8 +285,8 @@ bool EDIT_TOOL::Init()
// Footprint actions
menu.AddSeparator( singleModuleCondition );
menu.AddItem( PCB_ACTIONS::editFootprintInFpEditor, singleModuleCondition );
menu.AddItem( PCB_ACTIONS::updateFootprints, singleModuleCondition );
menu.AddItem( PCB_ACTIONS::exchangeFootprints, singleModuleCondition );
menu.AddItem( PCB_ACTIONS::updateFootprint, singleModuleCondition );
menu.AddItem( PCB_ACTIONS::changeFootprint, singleModuleCondition );
// Populate the context menu displayed during the edit tool (primarily the measure tool)
auto activeToolCondition = [ this ] ( const SELECTION& aSel ) {
@ -1191,11 +1203,33 @@ void EDIT_TOOL::FootprintFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector
int EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
{
const auto& selection = m_selectionTool->RequestSelection( FootprintFilter );
SELECTION& selection = m_selectionTool->RequestSelection( FootprintFilter );
MODULE* mod = (selection.Empty() ? nullptr : selection.FirstOfKind<MODULE> () );
bool updateMode = false;
bool currentMode = false;
bool updateMode = aEvent.IsAction( &PCB_ACTIONS::updateFootprints );
MODULE* mod = (selection.Empty() ? nullptr : selection.FirstOfKind<MODULE> () );
if( aEvent.IsAction( &PCB_ACTIONS::updateFootprint ) )
{
updateMode = true;
currentMode = true;
}
else if( aEvent.IsAction( &PCB_ACTIONS::updateFootprints ) )
{
updateMode = true;
currentMode = false;
}
else if( aEvent.IsAction( &PCB_ACTIONS::changeFootprint ) )
{
updateMode = false;
currentMode = true;
}
else if( aEvent.IsAction( &PCB_ACTIONS::changeFootprints ) )
{
updateMode = false;
currentMode = false;
}
else
wxFAIL_MSG( "ExchangeFootprints: unexpected action" );
// Footprint exchange could remove modules, so they have to be
// removed from the selection first
@ -1203,7 +1237,7 @@ int EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
// invoke the exchange dialog process
{
DIALOG_EXCHANGE_FOOTPRINTS dialog( frame(), mod, updateMode, mod != nullptr );
DIALOG_EXCHANGE_FOOTPRINTS dialog( frame(), mod, updateMode, currentMode );
dialog.ShowQuasiModal();
}
@ -1331,7 +1365,7 @@ bool EDIT_TOOL::updateModificationPoint( SELECTION& aSelection )
}
int EDIT_TOOL::editFootprintInFpEditor( const TOOL_EVENT& aEvent )
int EDIT_TOOL::EditFpInFpEditor( const TOOL_EVENT& aEvent )
{
const auto& selection = m_selectionTool->RequestSelection( FootprintFilter );
@ -1466,29 +1500,31 @@ int EDIT_TOOL::cutToClipboard( const TOOL_EVENT& aEvent )
void EDIT_TOOL::setTransitions()
{
Go( &EDIT_TOOL::Main, PCB_ACTIONS::editActivate.MakeEvent() );
Go( &EDIT_TOOL::Main, PCB_ACTIONS::move.MakeEvent() );
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::drag45Degree.MakeEvent() );
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::dragFreeAngle.MakeEvent() );
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCcw.MakeEvent() );
Go( &EDIT_TOOL::Flip, PCB_ACTIONS::flip.MakeEvent() );
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::remove.MakeEvent() );
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::removeAlt.MakeEvent() );
Go( &EDIT_TOOL::Properties, PCB_ACTIONS::properties.MakeEvent() );
Go( &EDIT_TOOL::MoveExact, PCB_ACTIONS::moveExact.MakeEvent() );
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicate.MakeEvent() );
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicateIncrement.MakeEvent() );
Go( &EDIT_TOOL::CreateArray,PCB_ACTIONS::createArray.MakeEvent() );
Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
Go( &EDIT_TOOL::Main, PCB_ACTIONS::editActivate.MakeEvent() );
Go( &EDIT_TOOL::Main, PCB_ACTIONS::move.MakeEvent() );
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::drag45Degree.MakeEvent() );
Go( &EDIT_TOOL::Drag, PCB_ACTIONS::dragFreeAngle.MakeEvent() );
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCw.MakeEvent() );
Go( &EDIT_TOOL::Rotate, PCB_ACTIONS::rotateCcw.MakeEvent() );
Go( &EDIT_TOOL::Flip, PCB_ACTIONS::flip.MakeEvent() );
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::remove.MakeEvent() );
Go( &EDIT_TOOL::Remove, PCB_ACTIONS::removeAlt.MakeEvent() );
Go( &EDIT_TOOL::Properties, PCB_ACTIONS::properties.MakeEvent() );
Go( &EDIT_TOOL::MoveExact, PCB_ACTIONS::moveExact.MakeEvent() );
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicate.MakeEvent() );
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicateIncrement.MakeEvent() );
Go( &EDIT_TOOL::CreateArray, PCB_ACTIONS::createArray.MakeEvent() );
Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
Go( &EDIT_TOOL::editFootprintInFpEditor, PCB_ACTIONS::editFootprintInFpEditor.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::updateFootprints.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::exchangeFootprints.MakeEvent() );
Go( &EDIT_TOOL::MeasureTool, ACTIONS::measureTool.MakeEvent() );
Go( &EDIT_TOOL::EditFpInFpEditor, PCB_ACTIONS::editFootprintInFpEditor.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::updateFootprint.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::updateFootprints.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::changeFootprint.MakeEvent() );
Go( &EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::changeFootprints.MakeEvent() );
Go( &EDIT_TOOL::MeasureTool, ACTIONS::measureTool.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, ACTIONS::copy.MakeEvent() );
Go( &EDIT_TOOL::cutToClipboard, ACTIONS::cut.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, ACTIONS::copy.MakeEvent() );
Go( &EDIT_TOOL::cutToClipboard, ACTIONS::cut.MakeEvent() );
}

View File

@ -212,7 +212,7 @@ private:
///> selected items.
bool updateModificationPoint( SELECTION& aSelection );
int editFootprintInFpEditor( const TOOL_EVENT& aEvent );
int EditFpInFpEditor( const TOOL_EVENT& aEvent );
bool invokeInlineRouter( int aDragMode );
bool isInteractiveDragEnabled() const;

View File

@ -114,10 +114,12 @@ public:
static TOOL_ACTION duplicateIncrement;
/// Update footprints to reflect any changes in the library
static TOOL_ACTION updateFootprint;
static TOOL_ACTION updateFootprints;
/// Exchange footprints of modules
static TOOL_ACTION exchangeFootprints;
static TOOL_ACTION changeFootprint;
static TOOL_ACTION changeFootprints;
/// Deleting a BOARD_ITEM
static TOOL_ACTION remove;
@ -254,6 +256,11 @@ public:
/// Duplicate zone onto another layer
static TOOL_ACTION zoneDuplicate;
static TOOL_ACTION listNets;
static TOOL_ACTION runDRC;
static TOOL_ACTION updatePcbFromSchematic;
static TOOL_ACTION showPythonConsole;
// Module editor tools
/// Activation of the drawing tool (placing a PAD)
static TOOL_ACTION placePad;

View File

@ -61,6 +61,8 @@
#include <widgets/progress_reporter.h>
#include <dialogs/dialog_find.h>
#include <dialogs/dialog_page_settings.h>
#include <pcb_netlist.h>
#include <dialogs/dialog_update_pcb.h>
using namespace std::placeholders;
@ -164,6 +166,17 @@ TOOL_ACTION PCB_ACTIONS::updateLocalRatsnest( "pcbnew.Control.updateLocalRatsnes
AS_GLOBAL, 0,
"", "" );
TOOL_ACTION PCB_ACTIONS::listNets( "pcbnew.Control.listNets",
AS_GLOBAL, 0,
_( "List Nets" ), _( "Show a list of nets with names and IDs" ),
list_nets_xpm );
TOOL_ACTION PCB_ACTIONS::showPythonConsole( "pcbnew.Control.showPythonConsole",
AS_GLOBAL, 0,
_( "Scripting Console" ), _( "Show the Python scripting console" ),
py_script_xpm );
class ZONE_CONTEXT_MENU : public ACTION_MENU
{
public:
@ -422,6 +435,34 @@ int PCB_EDITOR_CONTROL::Plot( const TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::UpdatePCBFromSchematic( const TOOL_EVENT& aEvent )
{
NETLIST netlist;
if( m_frame->FetchNetlistFromSchematic( netlist, PCB_EDIT_FRAME::ANNOTATION_DIALOG ) )
{
DIALOG_UPDATE_PCB updateDialog( m_frame, &netlist );
updateDialog.ShowModal();
SELECTION_TOOL* selectionTool = m_toolMgr->GetTool<SELECTION_TOOL>();
if( !selectionTool->GetSelection().Empty() )
m_toolMgr->InvokeTool( "pcbnew.InteractiveEdit" );
}
return 0;
}
int PCB_EDITOR_CONTROL::TogglePythonConsole( const TOOL_EVENT& aEvent )
{
#if defined( KICAD_SCRIPTING_WXPYTHON )
m_frame->ScriptingConsoleEnableDisable();
#endif
return 0;
}
int PCB_EDITOR_CONTROL::Find( const TOOL_EVENT& aEvent )
{
DIALOG_FIND dlg( m_frame );
@ -1344,29 +1385,30 @@ void PCB_EDITOR_CONTROL::calculateSelectionRatsnest()
void PCB_EDITOR_CONTROL::setTransitions()
{
Go( &PCB_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::SaveCopyAs, ACTIONS::saveCopyAs.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::PageSettings, ACTIONS::pageSettings.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Open, ACTIONS::open.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Save, ACTIONS::save.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::SaveAs, ACTIONS::saveAs.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::SaveCopyAs, ACTIONS::saveCopyAs.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::PageSettings, ACTIONS::pageSettings.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Plot, ACTIONS::plot.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Find, ACTIONS::find.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::Find, ACTIONS::find.MakeEvent() );
// Track & via size control
Go( &PCB_EDITOR_CONTROL::TrackWidthInc, PCB_ACTIONS::trackWidthInc.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::TrackWidthDec, PCB_ACTIONS::trackWidthDec.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ViaSizeInc, PCB_ACTIONS::viaSizeInc.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ViaSizeDec, PCB_ACTIONS::viaSizeDec.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::TrackWidthInc, PCB_ACTIONS::trackWidthInc.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::TrackWidthDec, PCB_ACTIONS::trackWidthDec.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ViaSizeInc, PCB_ACTIONS::viaSizeInc.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ViaSizeDec, PCB_ACTIONS::viaSizeDec.MakeEvent() );
// Zone actions
Go( &PCB_EDITOR_CONTROL::ZoneMerge, PCB_ACTIONS::zoneMerge.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ZoneDuplicate, PCB_ACTIONS::zoneDuplicate.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ZoneMerge, PCB_ACTIONS::zoneMerge.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ZoneDuplicate, PCB_ACTIONS::zoneDuplicate.MakeEvent() );
// Placing tools
Go( &PCB_EDITOR_CONTROL::PlaceTarget, PCB_ACTIONS::placeTarget.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::PlaceModule, PCB_ACTIONS::placeModule.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::PlaceTarget, PCB_ACTIONS::placeTarget.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::PlaceModule, PCB_ACTIONS::placeModule.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::DrillOrigin, PCB_ACTIONS::drillOrigin.MakeEvent() );
// Other
Go( &PCB_EDITOR_CONTROL::ToggleLockSelected, PCB_ACTIONS::toggleLock.MakeEvent() );
@ -1376,15 +1418,18 @@ void PCB_EDITOR_CONTROL::setTransitions()
Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, EVENTS::UnselectedEvent );
Go( &PCB_EDITOR_CONTROL::CrossProbePcbToSch, EVENTS::ClearedEvent );
Go( &PCB_EDITOR_CONTROL::CrossProbeSchToPcb, PCB_ACTIONS::crossProbeSchToPcb.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::DrillOrigin, PCB_ACTIONS::drillOrigin.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNet, PCB_ACTIONS::highlightNet.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ClearHighlight, PCB_ACTIONS::clearHighlight.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetTool.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HighlightNetCursor, PCB_ACTIONS::highlightNetSelection.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::LocalRatsnestTool, PCB_ACTIONS::localRatsnestTool.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HideDynamicRatsnest, PCB_ACTIONS::hideDynamicRatsnest.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::UpdateSelectionRatsnest, PCB_ACTIONS::updateLocalRatsnest.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::LocalRatsnestTool, PCB_ACTIONS::localRatsnestTool.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::HideDynamicRatsnest, PCB_ACTIONS::hideDynamicRatsnest.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::UpdateSelectionRatsnest,PCB_ACTIONS::updateLocalRatsnest.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ListNets, PCB_ACTIONS::listNets.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::UpdatePCBFromSchematic, ACTIONS::updatePcbFromSchematic.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::TogglePythonConsole, PCB_ACTIONS::showPythonConsole.MakeEvent() );
}

View File

@ -59,6 +59,9 @@ public:
int PageSettings( const TOOL_EVENT& aEvent );
int Plot( const TOOL_EVENT& aEvent );
int UpdatePCBFromSchematic( const TOOL_EVENT& aEvent );
int TogglePythonConsole( const TOOL_EVENT& aEvent );
int Find( const TOOL_EVENT& aEvent );
// Track & via size control
@ -129,6 +132,8 @@ public:
///> Shows local ratsnest of a component
int LocalRatsnestTool( const TOOL_EVENT& aEvent );
int ListNets( const TOOL_EVENT& aEvent );
private:
///> Event handler to recalculate dynamic ratsnest
void ratsnestTimer( wxTimerEvent& aEvent );

View File

@ -36,7 +36,7 @@
#include <zones.h>
#include <pcbnew_id.h>
#include <zones_functions_for_undo_redo.h>
#include <drc.h>
#include <tools/drc.h>
#include <connectivity/connectivity_data.h>
#include <widgets/progress_reporter.h>
#include <zone_filler.h>

View File

@ -40,7 +40,7 @@
#include <class_marker_pcb.h>
#include <pcbnew.h>
#include <drc.h>
#include <tools/drc.h>
#include <math_for_graphics.h>
#define STRAIGHT 0 // To be remove after math_for_graphics code cleanup