Move global commands to ACTIONs.

Also fixes a crash bug opening Edit Tracks and Vias dialog.
This commit is contained in:
Jeff Young 2019-06-03 21:06:58 +01:00
parent d7574db805
commit 3912c7407f
36 changed files with 542 additions and 548 deletions

View File

@ -90,9 +90,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode ) EVT_SELECT_DCODE( ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE, GERBVIEW_FRAME::OnSelectActiveDCode )
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
GERBVIEW_FRAME::Process_Special_Functions )
// Option toolbar // Option toolbar
EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR, EVT_TOOL( ID_TB_OPTIONS_SHOW_LAYERS_MANAGER_VERTICAL_TOOLBAR,
GERBVIEW_FRAME::OnToggleShowLayerManager ) GERBVIEW_FRAME::OnToggleShowLayerManager )

View File

@ -82,7 +82,6 @@ enum main_id
ID_SAVE_PROJECT, ID_SAVE_PROJECT,
ID_SAVE_PROJECT_AS, ID_SAVE_PROJECT_AS,
ID_LOAD_FILE, ID_LOAD_FILE,
ID_APPEND_FILE,
ID_NEW_BOARD, ID_NEW_BOARD,
ID_SAVE_BOARD, ID_SAVE_BOARD,
ID_SAVE_BOARD_AS, ID_SAVE_BOARD_AS,
@ -164,11 +163,6 @@ enum main_id
// Popup Menu (mouse Right button) (id consecutifs) // Popup Menu (mouse Right button) (id consecutifs)
ID_POPUP_GENERAL_START_RANGE, // first number
ID_POPUP_CANCEL_CURRENT_COMMAND,
ID_POPUP_CLOSE_CURRENT_TOOL,
ID_POPUP_GENERAL_END_RANGE, // last number
ID_ON_ZOOM_SELECT, ID_ON_ZOOM_SELECT,
ID_POPUP_ZOOM_START_RANGE, // first zoom id ID_POPUP_ZOOM_START_RANGE, // first zoom id
ID_POPUP_CANCEL, ID_POPUP_CANCEL,
@ -195,8 +189,6 @@ enum main_id
ID_POPUP_ZOOM_END_RANGE, // last zoom id ID_POPUP_ZOOM_END_RANGE, // last zoom id
ID_ON_GRID_SELECT, ID_ON_GRID_SELECT,
ID_POPUP_GRID_NEXT,
ID_POPUP_GRID_PREV,
ID_POPUP_GRID_SELECT, ID_POPUP_GRID_SELECT,
ID_POPUP_GRID_FIRST, ID_POPUP_GRID_FIRST,
ID_POPUP_GRID_LEVEL_1000 = ID_POPUP_GRID_FIRST, // These must be in same order as menu ID_POPUP_GRID_LEVEL_1000 = ID_POPUP_GRID_FIRST, // These must be in same order as menu

View File

@ -385,11 +385,6 @@ public:
LSET aNotAllowedLayersMask = LSET(), LSET aNotAllowedLayersMask = LSET(),
wxPoint aDlgPosition = wxDefaultPosition ); wxPoint aDlgPosition = wxDefaultPosition );
/* Display a list of two copper layers to choose a pair of copper layers
* the layer pair is used to fast switch between copper layers when placing vias
*/
void SelectCopperLayerPair();
virtual void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ); virtual void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer );
/** /**

View File

@ -293,6 +293,7 @@ set( PCBNEW_CLASS_SRCS
tools/drawing_tool.cpp tools/drawing_tool.cpp
tools/edit_tool.cpp tools/edit_tool.cpp
tools/global_edit_tool.cpp
tools/grid_helper.cpp tools/grid_helper.cpp
tools/microwave_tool.cpp tools/microwave_tool.cpp
tools/footprint_editor_tools.cpp tools/footprint_editor_tools.cpp

View File

@ -36,6 +36,7 @@ using namespace std::placeholders;
#include <class_zone.h> #include <class_zone.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/pcb_actions.h> #include <tools/pcb_actions.h>
#include <tools/global_edit_tool.h>
#include <dialog_global_deletion.h> #include <dialog_global_deletion.h>
@ -57,12 +58,12 @@ DIALOG_GLOBAL_DELETION::DIALOG_GLOBAL_DELETION( PCB_EDIT_FRAME* parent ) :
} }
void PCB_EDIT_FRAME::InstallPcbGlobalDeleteFrame( const wxPoint& pos ) int GLOBAL_EDIT_TOOL::GlobalDeletions( const TOOL_EVENT& aEvent )
{ {
DIALOG_GLOBAL_DELETION dlg( this ); DIALOG_GLOBAL_DELETION dlg( frame() );
dlg.SetCurrentLayer( GetActiveLayer() ); dlg.SetCurrentLayer( frame()->GetActiveLayer() );
dlg.ShowModal(); dlg.ShowModal();
return 0;
} }

View File

@ -32,7 +32,7 @@
#include <class_edge_mod.h> #include <class_edge_mod.h>
#include <class_pcb_text.h> #include <class_pcb_text.h>
#include <widgets/unit_binder.h> #include <widgets/unit_binder.h>
#include <tools/global_edit_tool.h>
#include <dialog_global_edit_text_and_graphics_base.h> #include <dialog_global_edit_text_and_graphics_base.h>
@ -408,10 +408,12 @@ bool DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS::TransferDataFromWindow()
} }
void PCB_EDIT_FRAME::OnEditTextAndGraphics( wxCommandEvent& event ) int GLOBAL_EDIT_TOOL::EditTextAndGraphics( const TOOL_EVENT& aEvent )
{ {
DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS dlg( this ); DIALOG_GLOBAL_EDIT_TEXT_AND_GRAPHICS dlg( frame() );
dlg.ShowModal(); dlg.ShowModal();
return 0;
} }

View File

@ -32,6 +32,7 @@
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/selection.h> #include <tool/selection.h>
#include <tools/selection_tool.h> #include <tools/selection_tool.h>
#include <tools/global_edit_tool.h>
#include "dialog_global_edit_tracks_and_vias_base.h" #include "dialog_global_edit_tracks_and_vias_base.h"
// Columns of netclasses grid // Columns of netclasses grid
@ -219,7 +220,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid()
bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow() bool DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::TransferDataToWindow()
{ {
SELECTION& selection = GetToolManager()->GetTool<SELECTION_TOOL>()->GetSelection(); SELECTION& selection = m_parent->GetToolManager()->GetTool<SELECTION_TOOL>()->GetSelection();
auto item = dynamic_cast<BOARD_CONNECTED_ITEM*>( selection.Front() ); auto item = dynamic_cast<BOARD_CONNECTED_ITEM*>( selection.Front() );
m_tracks->SetValue( g_modifyTracks ); m_tracks->SetValue( g_modifyTracks );
@ -368,9 +369,11 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnSizeNetclassGrid( wxSizeEvent& event
} }
void PCB_EDIT_FRAME::OnEditTracksAndVias( wxCommandEvent& event ) int GLOBAL_EDIT_TOOL::EditTracksAndVias( const TOOL_EVENT& aEvent )
{ {
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this ); DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( frame() );
dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR
return 0;
} }

View File

@ -22,16 +22,14 @@
*/ */
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <class_board.h>
#include <grid_layer_box_helpers.h> #include <grid_layer_box_helpers.h>
#include <board_commit.h>
#include <class_drawsegment.h> #include <class_drawsegment.h>
#include <class_track.h> #include <class_track.h>
#include <view/view.h> #include <view/view.h>
#include <widgets/wx_grid.h> #include <widgets/wx_grid.h>
#include <class_zone.h> #include <class_zone.h>
#include <class_board.h>
#include "dialog_swap_layers_base.h" #include "dialog_swap_layers.h"
class LAYER_GRID_TABLE : public wxGridTableBase class LAYER_GRID_TABLE : public wxGridTableBase
@ -71,28 +69,6 @@ public:
}; };
class DIALOG_SWAP_LAYERS : public DIALOG_SWAP_LAYERS_BASE
{
private:
PCB_EDIT_FRAME* m_parent;
PCB_LAYER_ID* m_layerDestinations;
LAYER_GRID_TABLE* m_gridTable;
public:
DIALOG_SWAP_LAYERS( PCB_EDIT_FRAME* aParent, PCB_LAYER_ID* aArray );
~DIALOG_SWAP_LAYERS() override;
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void OnSize( wxSizeEvent& event ) override;
void adjustGridColumns( int aWidth );
};
DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS( PCB_EDIT_FRAME* aParent, PCB_LAYER_ID* aArray ) : DIALOG_SWAP_LAYERS::DIALOG_SWAP_LAYERS( PCB_EDIT_FRAME* aParent, PCB_LAYER_ID* aArray ) :
DIALOG_SWAP_LAYERS_BASE( aParent ), DIALOG_SWAP_LAYERS_BASE( aParent ),
m_parent( aParent ), m_parent( aParent ),
@ -185,74 +161,3 @@ void DIALOG_SWAP_LAYERS::OnSize( wxSizeEvent& event )
} }
bool processBoardItem( PCB_EDIT_FRAME* aFrame, BOARD_COMMIT& commit, BOARD_ITEM* aItem,
PCB_LAYER_ID* new_layer )
{
if( new_layer[ aItem->GetLayer() ] != aItem->GetLayer() )
{
commit.Modify( aItem );
aItem->SetLayer( new_layer[ aItem->GetLayer() ] );
aFrame->GetGalCanvas()->GetView()->Update( aItem, KIGFX::GEOMETRY );
return true;
}
return false;
}
void PCB_EDIT_FRAME::Swap_Layers( wxCommandEvent& event )
{
PCB_LAYER_ID new_layer[PCB_LAYER_ID_COUNT];
DIALOG_SWAP_LAYERS dlg( this, new_layer );
if( dlg.ShowModal() != wxID_OK )
return;
BOARD_COMMIT commit( this );
bool hasChanges = false;
// Change tracks.
for( auto segm : GetBoard()->Tracks() )
{
if( segm->Type() == PCB_VIA_T )
{
VIA* via = (VIA*) segm;
PCB_LAYER_ID top_layer, bottom_layer;
if( via->GetViaType() == VIA_THROUGH )
continue;
via->LayerPair( &top_layer, &bottom_layer );
if( new_layer[bottom_layer] != bottom_layer || new_layer[top_layer] != top_layer )
{
commit.Modify( via );
via->SetLayerPair( new_layer[top_layer], new_layer[bottom_layer] );
GetGalCanvas()->GetView()->Update( via, KIGFX::GEOMETRY );
hasChanges = true;
}
}
else
{
hasChanges |= processBoardItem( this, commit, segm, new_layer );
}
}
for( BOARD_ITEM* zone : GetBoard()->Zones() )
{
hasChanges |= processBoardItem( this, commit, zone, new_layer );
}
for( BOARD_ITEM* drawing : GetBoard()->Drawings() )
{
hasChanges |= processBoardItem( this, commit, drawing, new_layer );
}
if( hasChanges )
{
OnModify();
commit.Push( "Layers moved" );
GetGalCanvas()->Refresh();
}
}

View File

@ -0,0 +1,54 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 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
*/
#ifndef _DIALOG_SCRIPTING_H_
#define _DIALOG_SCRIPTING_H_
#include "dialog_swap_layers_base.h"
class PCB_EDIT_FRAME;
class LAYER_GRID_TABLE;
class DIALOG_SWAP_LAYERS : public DIALOG_SWAP_LAYERS_BASE
{
private:
PCB_EDIT_FRAME* m_parent;
PCB_LAYER_ID* m_layerDestinations;
LAYER_GRID_TABLE* m_gridTable;
public:
DIALOG_SWAP_LAYERS( PCB_EDIT_FRAME* aParent, PCB_LAYER_ID* aArray );
~DIALOG_SWAP_LAYERS() override;
private:
bool TransferDataToWindow() override;
bool TransferDataFromWindow() override;
void OnSize( wxSizeEvent& event ) override;
void adjustGridColumns( int aWidth );
};
#endif

View File

@ -66,10 +66,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
switch( id ) // Some (not all ) edit commands must be finished or aborted switch( id ) // Some (not all ) edit commands must be finished or aborted
{ {
case wxID_CUT:
case wxID_COPY:
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
break; break;
default: // Finish (abort) the command default: // Finish (abort) the command
@ -139,18 +136,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
} }
break; break;
case ID_PCB_GLOBAL_DELETE:
InstallPcbGlobalDeleteFrame( wxDefaultPosition );
break;
case ID_GET_NETLIST: case ID_GET_NETLIST:
InstallNetlistFrame(); InstallNetlistFrame();
break; break;
case ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR:
SelectCopperLayerPair();
break;
case ID_TOOLBARH_PCB_SELECT_LAYER: case ID_TOOLBARH_PCB_SELECT_LAYER:
SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) ); SetActiveLayer( ToLAYER_ID( m_SelLayerBox->GetLayerSelection() ) );
@ -158,14 +147,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
GetGalCanvas()->Refresh(); GetGalCanvas()->Refresh();
break; break;
case ID_MENU_PCB_CLEAN:
Clean_Pcb();
break;
case ID_MENU_PCB_SWAP_LAYERS:
Swap_Layers( event );
break;
case ID_MENU_ARCHIVE_MODULES_IN_LIBRARY: case ID_MENU_ARCHIVE_MODULES_IN_LIBRARY:
ArchiveModulesOnBoard( false ); ArchiveModulesOnBoard( false );
break; break;

View File

@ -273,9 +273,6 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
return false; return false;
} }
case ID_APPEND_FILE:
wxFAIL_MSG( "OBSOLETE! Should have gone though modern toolset." );
case ID_NEW_BOARD: case ID_NEW_BOARD:
{ {
if( !Clear_Pcb( true ) ) if( !Clear_Pcb( true ) )

View File

@ -87,7 +87,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_MODEDIT_SAVE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_SAVE, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_AS, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_MODEDIT_SAVE_AS, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_REVERT_PART, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_OPEN_MODULE_VIEWER, FOOTPRINT_EDIT_FRAME::Process_Special_Functions ) EVT_TOOL( ID_OPEN_MODULE_VIEWER, FOOTPRINT_EDIT_FRAME::Process_Special_Functions )
EVT_TOOL( ID_MODEDIT_SAVE_PNG, FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng ) EVT_TOOL( ID_MODEDIT_SAVE_PNG, FOOTPRINT_EDIT_FRAME::OnSaveFootprintAsPng )
@ -115,12 +114,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( wxID_PREFERENCES, FOOTPRINT_EDIT_FRAME::ProcessPreferences ) EVT_MENU( wxID_PREFERENCES, FOOTPRINT_EDIT_FRAME::ProcessPreferences )
// popup commands // popup commands
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
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_GRID_SETTINGS, FOOTPRINT_EDIT_FRAME::OnGridSettings ) EVT_MENU( ID_GRID_SETTINGS, FOOTPRINT_EDIT_FRAME::OnGridSettings )
// UI update events. // UI update events.
@ -130,9 +123,6 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_UPDATE_UI( ID_ADD_FOOTPRINT_TO_BOARD, EVT_UPDATE_UI( ID_ADD_FOOTPRINT_TO_BOARD,
FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard ) FOOTPRINT_EDIT_FRAME::OnUpdateInsertModuleInBoard )
EVT_UPDATE_UI_RANGE( ID_MODEDIT_PAD_TOOL, ID_MODEDIT_MEASUREMENT_TOOL,
FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_MODEDIT_EDIT_MODULE_PROPERTIES, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected ) EVT_UPDATE_UI( ID_MODEDIT_EDIT_MODULE_PROPERTIES, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
EVT_UPDATE_UI( ID_MODEDIT_PAD_SETTINGS, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected ) EVT_UPDATE_UI( ID_MODEDIT_PAD_SETTINGS, FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected )
@ -517,15 +507,6 @@ void FOOTPRINT_EDIT_FRAME::CloseModuleEditor( wxCommandEvent& Event )
} }
void FOOTPRINT_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
{
aEvent.Enable( GetBoard()->GetFirstModule() != NULL );
if( aEvent.GetEventObject() == m_drawToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected( wxUpdateUIEvent& aEvent ) void FOOTPRINT_EDIT_FRAME::OnUpdateModuleSelected( wxUpdateUIEvent& aEvent )
{ {
aEvent.Enable( GetBoard()->GetFirstModule() != NULL ); aEvent.Enable( GetBoard()->GetFirstModule() != NULL );

View File

@ -145,11 +145,6 @@ public:
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription() ///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override; EDA_HOTKEY* GetHotKeyDescription( int aCommand ) const override;
/**
* Handle most of tools og the vertical right toolbar ("Tools" toolbar)
*/
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent ); void OnUpdateModuleSelected( wxUpdateUIEvent& aEvent );
void OnUpdateModuleTargeted( wxUpdateUIEvent& aEvent ); void OnUpdateModuleTargeted( wxUpdateUIEvent& aEvent );
void OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent ); void OnUpdateLoadModuleFromBoard( wxUpdateUIEvent& aEvent );

View File

@ -353,10 +353,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_treePane->GetLibTree()->Refresh(); m_treePane->GetLibTree()->Refresh();
break; break;
case ID_MODEDIT_REVERT_PART:
RevertFootprint();
break;
case ID_MODEDIT_CUT_PART: case ID_MODEDIT_CUT_PART:
case ID_MODEDIT_COPY_PART: case ID_MODEDIT_COPY_PART:
if( getTargetFPID().IsValid() ) if( getTargetFPID().IsValid() )

View File

@ -68,7 +68,7 @@ FOOTPRINT_TREE_PANE::FOOTPRINT_TREE_PANE( FOOTPRINT_EDIT_FRAME* aParent )
menuPart->Add( _( "Save" ), ID_MODEDIT_SAVE, save_xpm ); menuPart->Add( _( "Save" ), ID_MODEDIT_SAVE, save_xpm );
menuPart->Add( _( "Save a Copy As..." ), ID_MODEDIT_SAVE_AS, save_as_xpm ); menuPart->Add( _( "Save a Copy As..." ), ID_MODEDIT_SAVE_AS, save_as_xpm );
menuPart->Add( _( "Delete" ), ID_MODEDIT_DELETE_PART, delete_xpm ); menuPart->Add( _( "Delete" ), ID_MODEDIT_DELETE_PART, delete_xpm );
menuPart->Add( _( "Revert" ), ID_MODEDIT_REVERT_PART, undo_xpm ); menuPart->Add( ACTIONS::revert );
menuPart->AppendSeparator(); menuPart->AppendSeparator();
menuPart->Add( _( "Cut" ), ID_MODEDIT_CUT_PART, cut_xpm ); menuPart->Add( _( "Cut" ), ID_MODEDIT_CUT_PART, cut_xpm );

View File

@ -80,10 +80,7 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
fileMenu->AddSeparator(); fileMenu->AddSeparator();
fileMenu->AddItem( ACTIONS::save, modifiedDocumentCondition ); fileMenu->AddItem( ACTIONS::save, modifiedDocumentCondition );
fileMenu->AddItem( ACTIONS::saveAs, libraryPartCondition ); fileMenu->AddItem( ACTIONS::saveAs, libraryPartCondition );
fileMenu->AddItem( ID_MODEDIT_REVERT_PART, fileMenu->AddItem( ACTIONS::revert, modifiedDocumentCondition );
_( "Revert" ),
_( "Throw away changes" ),
undo_xpm, modifiedDocumentCondition );
fileMenu->AddSeparator(); fileMenu->AddSeparator();
@ -276,12 +273,10 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
//-- Inspect menu ------------------------------------------------------- //-- Inspect menu -------------------------------------------------------
// //
wxMenu* inspectMenu = new wxMenu; CONDITIONAL_MENU* inspectMenu = new CONDITIONAL_MENU( false, selTool );
AddMenuItem( inspectMenu, ID_MODEDIT_MEASUREMENT_TOOL, inspectMenu->AddItem( ACTIONS::measureTool, SELECTION_CONDITIONS::ShowAlways );
AddHotkeyName( _( "&Measure" ), m_hotkeysDescrList, HK_MEASURE_TOOL ), inspectMenu->Resolve();
_( "Measure distance" ),
KiBitmap( measurement_xpm ) );
//-- Tools menu ------------------------------------------------------- //-- Tools menu -------------------------------------------------------
// //

View File

@ -245,31 +245,18 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
editMenu->AddItem( ACTIONS::find, SELECTION_CONDITIONS::ShowAlways ); editMenu->AddItem( ACTIONS::find, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddSeparator(); editMenu->AddSeparator();
editMenu->AddItem( ID_PCB_EDIT_TRACKS_AND_VIAS, editMenu->AddItem( PCB_ACTIONS::editTracksAndVias, SELECTION_CONDITIONS::ShowAlways );
_( "Edit Track && Via Properties..." ), "", editMenu->AddItem( PCB_ACTIONS::editTextAndGraphics, SELECTION_CONDITIONS::ShowAlways );
width_track_via_xpm, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( ID_MENU_PCB_EDIT_TEXT_AND_GRAPHICS,
_( "Edit Text && Graphic Properties..." ), "",
reset_text_xpm, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( PCB_ACTIONS::changeFootprints, SELECTION_CONDITIONS::ShowAlways ); editMenu->AddItem( PCB_ACTIONS::changeFootprints, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( ID_MENU_PCB_SWAP_LAYERS, editMenu->AddItem( PCB_ACTIONS::swapLayers, SELECTION_CONDITIONS::ShowAlways );
_( "Swap Layers..." ),
_( "Move tracks or drawings from a layer to another layer" ),
swap_layer_xpm, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddSeparator(); editMenu->AddSeparator();
editMenu->AddItem( PCB_ACTIONS::zoneFillAll, SELECTION_CONDITIONS::ShowAlways ); editMenu->AddItem( PCB_ACTIONS::zoneFillAll, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( PCB_ACTIONS::zoneUnfillAll, SELECTION_CONDITIONS::ShowAlways ); editMenu->AddItem( PCB_ACTIONS::zoneUnfillAll, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddSeparator(); editMenu->AddSeparator();
editMenu->AddItem( ID_PCB_GLOBAL_DELETE, editMenu->AddItem( PCB_ACTIONS::globalDeletions, SELECTION_CONDITIONS::ShowAlways );
_( "Global Deletions..." ), editMenu->AddItem( PCB_ACTIONS::cleanupTracksAndVias, SELECTION_CONDITIONS::ShowAlways );
_( "Delete tracks, footprints and graphic items from board" ),
general_deletions_xpm, SELECTION_CONDITIONS::ShowAlways );
editMenu->AddItem( ID_MENU_PCB_CLEAN,
_( "Cleanup Tracks and Vias..." ),
_( "Clean stubs, vias, delete break points or unconnected tracks" ),
delete_xpm, SELECTION_CONDITIONS::ShowAlways );
editMenu->Resolve(); editMenu->Resolve();
@ -395,9 +382,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways ); contrastModeSubMenu->AddItem( PCB_ACTIONS::layerAlphaInc, SELECTION_CONDITIONS::ShowAlways );
viewMenu->AddMenu( contrastModeSubMenu ); viewMenu->AddMenu( contrastModeSubMenu );
viewMenu->AddCheckItem( ID_MENU_PCB_FLIP_VIEW, viewMenu->AddCheckItem( PCB_ACTIONS::flipBoard, boardFlippedCondition );
_( "Flip &Board View" ), _( "Flip (mirror) the board view" ),
flip_board_xpm, boardFlippedCondition );
#ifdef __APPLE__ #ifdef __APPLE__
viewMenu->AppendSeparator(); viewMenu->AppendSeparator();
@ -447,47 +432,19 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
// //
CONDITIONAL_MENU* routeMenu = new CONDITIONAL_MENU( false, selTool ); CONDITIONAL_MENU* routeMenu = new CONDITIONAL_MENU( false, selTool );
routeMenu->AddItem( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, routeMenu->AddItem( PCB_ACTIONS::selectLayerPair, SELECTION_CONDITIONS::ShowAlways );
_( "Set &Layer Pair..." ), _( "Change active layer pair" ),
select_layer_pair_xpm, SELECTION_CONDITIONS::ShowAlways );
routeMenu->AddSeparator(); routeMenu->AddSeparator();
routeMenu->AddItem( ID_TRACK_BUTT, routeMenu->AddItem( PCB_ACTIONS::routerActivateSingle, SELECTION_CONDITIONS::ShowAlways );
AddHotkeyName( _( "&Single Track" ), g_Board_Editor_Hotkeys_Descr, routeMenu->AddItem( PCB_ACTIONS::routerActivateDiffPair, SELECTION_CONDITIONS::ShowAlways );
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->AddSeparator();
routeMenu->AddItem( ID_TUNE_SINGLE_TRACK_LEN_BUTT, routeMenu->AddItem( PCB_ACTIONS::routerTuneSingleTrace, SELECTION_CONDITIONS::ShowAlways );
AddHotkeyName( _( "&Tune Track Length" ), g_Board_Editor_Hotkeys_Descr, routeMenu->AddItem( PCB_ACTIONS::routerTuneDiffPair, SELECTION_CONDITIONS::ShowAlways );
HK_ROUTE_TUNE_SINGLE, IS_ACCELERATOR ), routeMenu->AddItem( PCB_ACTIONS::routerTuneDiffPairSkew, SELECTION_CONDITIONS::ShowAlways );
_( "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->AddSeparator();
routeMenu->AddItem( ID_MENU_INTERACTIVE_ROUTER_SETTINGS, routeMenu->AddItem( PCB_ACTIONS::routerSettingsDialog, SELECTION_CONDITIONS::ShowAlways );
_( "&Interactive Router Settings..." ),
_( "Configure interactive router" ),
tools_xpm, SELECTION_CONDITIONS::ShowAlways );
//-- Inspect Menu -------------------------------------------------------- //-- Inspect Menu --------------------------------------------------------
// //

View File

@ -68,6 +68,7 @@
#include <tools/pcbnew_picker_tool.h> #include <tools/pcbnew_picker_tool.h>
#include <tools/point_editor.h> #include <tools/point_editor.h>
#include <tools/edit_tool.h> #include <tools/edit_tool.h>
#include <tools/global_edit_tool.h>
#include <tools/drawing_tool.h> #include <tools/drawing_tool.h>
#include <tools/point_editor.h> #include <tools/point_editor.h>
#include <tools/pcbnew_control.h> #include <tools/pcbnew_control.h>
@ -123,9 +124,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
// Menu Files: // Menu Files:
EVT_MENU( ID_MAIN_MENUBAR, PCB_EDIT_FRAME::Process_Special_Functions ) EVT_MENU( ID_MAIN_MENUBAR, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_FLIP_VIEW, PCB_EDIT_FRAME::OnFlipPcbView )
EVT_MENU( ID_APPEND_FILE, PCB_EDIT_FRAME::Files_io )
EVT_MENU( ID_IMPORT_NON_KICAD_BOARD, PCB_EDIT_FRAME::Files_io ) EVT_MENU( ID_IMPORT_NON_KICAD_BOARD, PCB_EDIT_FRAME::Files_io )
EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, PCB_EDIT_FRAME::OnFileHistory ) EVT_MENU_RANGE( ID_FILE1, ID_FILEMAX, PCB_EDIT_FRAME::OnFileHistory )
@ -161,13 +160,6 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_PCB_GEN_CMP_FILE, PCB_EDIT_FRAME::RecreateCmpFileFromBoard ) EVT_MENU( ID_PCB_GEN_CMP_FILE, PCB_EDIT_FRAME::RecreateCmpFileFromBoard )
EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, PCB_EDIT_FRAME::RecreateBOMFileFromBoard ) EVT_MENU( ID_PCB_GEN_BOM_FILE_FROM_BOARD, PCB_EDIT_FRAME::RecreateBOMFileFromBoard )
// menu Miscellaneous
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_SWAP_LAYERS, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_EDIT_TEXT_AND_GRAPHICS, PCB_EDIT_FRAME::OnEditTextAndGraphics )
// Menu Get Design Rules Editor // Menu Get Design Rules Editor
EVT_MENU( ID_BOARD_SETUP_DIALOG, PCB_EDIT_FRAME::ShowBoardSetupDialog ) EVT_MENU( ID_BOARD_SETUP_DIALOG, PCB_EDIT_FRAME::ShowBoardSetupDialog )
@ -195,31 +187,20 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, EVT_TOOL( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
PCB_EDIT_FRAME::OnSelectOptionToolbar ) PCB_EDIT_FRAME::OnSelectOptionToolbar )
EVT_MENU_RANGE( ID_POPUP_PCB_START_RANGE, ID_POPUP_PCB_END_RANGE,
PCB_EDIT_FRAME::Process_Special_Functions )
// Tracks and vias sizes general options // Tracks and vias sizes general options
EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE, EVT_MENU_RANGE( ID_POPUP_PCB_SELECT_WIDTH_START_RANGE,
ID_POPUP_PCB_SELECT_WIDTH_END_RANGE, ID_POPUP_PCB_SELECT_WIDTH_END_RANGE,
PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event ) PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event )
// popup menus
EVT_MENU_RANGE( ID_POPUP_GENERAL_START_RANGE, ID_POPUP_GENERAL_END_RANGE,
PCB_EDIT_FRAME::Process_Special_Functions )
// User interface update event handlers. // User interface update event handlers.
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::OnUpdateLayerPair ) EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR, PCB_EDIT_FRAME::OnUpdateLayerPair )
EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::OnUpdateLayerSelectBox ) EVT_UPDATE_UI( ID_TOOLBARH_PCB_SELECT_LAYER, PCB_EDIT_FRAME::OnUpdateLayerSelectBox )
EVT_UPDATE_UI( ID_NO_TOOL_SELECTED, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_ZOOM_SELECTION, PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth ) EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::OnUpdateSelectViaSize ) EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::OnUpdateSelectViaSize )
EVT_UPDATE_UI_RANGE( ID_POPUP_PCB_SELECT_WIDTH1, ID_POPUP_PCB_SELECT_WIDTH8, EVT_UPDATE_UI_RANGE( ID_POPUP_PCB_SELECT_WIDTH1, ID_POPUP_PCB_SELECT_WIDTH8,
PCB_EDIT_FRAME::OnUpdateSelectTrackWidth ) PCB_EDIT_FRAME::OnUpdateSelectTrackWidth )
EVT_UPDATE_UI_RANGE( ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8, EVT_UPDATE_UI_RANGE( ID_POPUP_PCB_SELECT_VIASIZE1, ID_POPUP_PCB_SELECT_VIASIZE8,
PCB_EDIT_FRAME::OnUpdateSelectViaSize ) PCB_EDIT_FRAME::OnUpdateSelectViaSize )
EVT_UPDATE_UI_RANGE( ID_PCB_HIGHLIGHT_BUTT, ID_PCB_MEASUREMENT_TOOL,
PCB_EDIT_FRAME::OnUpdateVerticalToolbar )
EVT_UPDATE_UI_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD, EVT_UPDATE_UI_RANGE( ID_PCB_MUWAVE_START_CMD, ID_PCB_MUWAVE_END_CMD,
PCB_EDIT_FRAME::OnUpdateMuWaveToolbar ) PCB_EDIT_FRAME::OnUpdateMuWaveToolbar )
@ -470,6 +451,7 @@ void PCB_EDIT_FRAME::setupTools()
m_toolManager->RegisterTool( new ROUTER_TOOL ); m_toolManager->RegisterTool( new ROUTER_TOOL );
m_toolManager->RegisterTool( new LENGTH_TUNER_TOOL ); m_toolManager->RegisterTool( new LENGTH_TUNER_TOOL );
m_toolManager->RegisterTool( new EDIT_TOOL ); m_toolManager->RegisterTool( new EDIT_TOOL );
m_toolManager->RegisterTool( new GLOBAL_EDIT_TOOL );
m_toolManager->RegisterTool( new PAD_TOOL ); m_toolManager->RegisterTool( new PAD_TOOL );
m_toolManager->RegisterTool( new DRAWING_TOOL ); m_toolManager->RegisterTool( new DRAWING_TOOL );
m_toolManager->RegisterTool( new POINT_EDITOR ); m_toolManager->RegisterTool( new POINT_EDITOR );
@ -1107,15 +1089,6 @@ void PCB_EDIT_FRAME::OnRunEeschema( wxCommandEvent& event )
} }
void PCB_EDIT_FRAME::OnFlipPcbView( wxCommandEvent& evt )
{
auto view = GetGalCanvas()->GetView();
view->SetMirror( evt.IsChecked(), false );
view->RecacheAllItems();
Refresh();
}
void PCB_EDIT_FRAME::PythonPluginsReload() void PCB_EDIT_FRAME::PythonPluginsReload()
{ {
// Reload Python plugins if they are newer than // Reload Python plugins if they are newer than

View File

@ -301,7 +301,6 @@ public:
void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent ); void OnUpdateLayerSelectBox( wxUpdateUIEvent& aEvent );
bool LayerManagerShown(); bool LayerManagerShown();
bool MicrowaveToolbarShown(); bool MicrowaveToolbarShown();
void OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent );
void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent ); void OnUpdateSelectViaSize( wxUpdateUIEvent& aEvent );
void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent ); void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent ); void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent );
@ -564,8 +563,6 @@ public:
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
void OnFlipPcbView( wxCommandEvent& event ); void OnFlipPcbView( wxCommandEvent& event );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
/** /**
* Function GenFootprintsPositionFile * Function GenFootprintsPositionFile
* Calls DoGenFootprintsPositionFile to create a footprint position file * Calls DoGenFootprintsPositionFile to create a footprint position file
@ -627,7 +624,6 @@ public:
* ID_LOAD_FILE * ID_LOAD_FILE
* ID_MENU_READ_BOARD_BACKUP_FILE * ID_MENU_READ_BOARD_BACKUP_FILE
* ID_MENU_RECOVER_BOARD_AUTOSAVE * ID_MENU_RECOVER_BOARD_AUTOSAVE
* ID_APPEND_FILE
* ID_NEW_BOARD * ID_NEW_BOARD
* ID_SAVE_BOARD * ID_SAVE_BOARD
* ID_COPY_BOARD_AS * ID_COPY_BOARD_AS
@ -1001,15 +997,6 @@ public:
bool aPrepareUndoCommand = true ); bool aPrepareUndoCommand = true );
/**
* Function Clean_Pcb
* Clean up the board (remove redundant vias, not connected tracks
* and merges collinear track segments)
* Install the cleanup dialog frame to know what should be cleaned
* and run the cleanup function
*/
void Clean_Pcb();
/** /**
* Function SendMessageToEESCHEMA * Function SendMessageToEESCHEMA
* sends a message to the schematic editor so that it may move its cursor * sends a message to the schematic editor so that it may move its cursor

View File

@ -41,19 +41,6 @@ enum pcbnew_ids
ID_PCB_PLACE_GRID_COORD_BUTT, ID_PCB_PLACE_GRID_COORD_BUTT,
ID_PCB_MEASUREMENT_TOOL, ID_PCB_MEASUREMENT_TOOL,
ID_DIFF_PAIR_BUTT,
ID_TUNE_SINGLE_TRACK_LEN_BUTT,
ID_TUNE_DIFF_PAIR_LEN_BUTT,
ID_TUNE_DIFF_PAIR_SKEW_BUTT,
ID_MENU_DIFF_PAIR_DIMENSIONS,
ID_MENU_INTERACTIVE_ROUTER_SETTINGS,
ID_MENU_PCB_FLIP_VIEW,
ID_POPUP_PCB_START_RANGE,
ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST,
ID_POPUP_PCB_END_RANGE,
// Tracks and vias sizes general options // Tracks and vias sizes general options
ID_AUX_TOOLBAR_PCB_VIA_SIZE, ID_AUX_TOOLBAR_PCB_VIA_SIZE,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
@ -118,10 +105,6 @@ enum pcbnew_ids
ID_MENU_RECOVER_BOARD_AUTOSAVE, ID_MENU_RECOVER_BOARD_AUTOSAVE,
ID_MENU_ARCHIVE_MODULES_IN_LIBRARY, ID_MENU_ARCHIVE_MODULES_IN_LIBRARY,
ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES, ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES,
ID_PCB_EDIT_TRACKS_AND_VIAS,
ID_MENU_PCB_CLEAN,
ID_MENU_PCB_SWAP_LAYERS,
ID_MENU_PCB_EDIT_TEXT_AND_GRAPHICS,
ID_GEN_EXPORT_FILE_IDF3, ID_GEN_EXPORT_FILE_IDF3,
ID_GEN_EXPORT_FILE_VRML, ID_GEN_EXPORT_FILE_VRML,
@ -159,7 +142,6 @@ enum pcbnew_ids
ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD, ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD,
ID_PCB_MUWAVE_END_CMD, ID_PCB_MUWAVE_END_CMD,
ID_PCB_GLOBAL_DELETE,
ID_TOOLBARH_PCB_SELECT_LAYER, ID_TOOLBARH_PCB_SELECT_LAYER,
// Module editor right vertical tool bar commands. // Module editor right vertical tool bar commands.
@ -179,7 +161,6 @@ enum pcbnew_ids
ID_MODEDIT_SAVE, ID_MODEDIT_SAVE,
ID_MODEDIT_SAVE_AS, ID_MODEDIT_SAVE_AS,
ID_MODEDIT_SAVE_PNG, ID_MODEDIT_SAVE_PNG,
ID_MODEDIT_REVERT_PART,
ID_MODEDIT_DELETE_PART, ID_MODEDIT_DELETE_PART,
ID_MODEDIT_COPY_PART, ID_MODEDIT_COPY_PART,
ID_MODEDIT_CUT_PART, ID_MODEDIT_CUT_PART,

View File

@ -254,9 +254,9 @@ int LENGTH_TUNER_TOOL::TuneDiffPairSkew( const TOOL_EVENT& aEvent )
void LENGTH_TUNER_TOOL::setTransitions() void LENGTH_TUNER_TOOL::setTransitions()
{ {
Go( &LENGTH_TUNER_TOOL::TuneSingleTrace, PCB_ACTIONS::routerActivateTuneSingleTrace.MakeEvent() ); Go( &LENGTH_TUNER_TOOL::TuneSingleTrace, PCB_ACTIONS::routerTuneSingleTrace.MakeEvent() );
Go( &LENGTH_TUNER_TOOL::TuneDiffPair, PCB_ACTIONS::routerActivateTuneDiffPair.MakeEvent() ); Go( &LENGTH_TUNER_TOOL::TuneDiffPair, PCB_ACTIONS::routerTuneDiffPair.MakeEvent() );
Go( &LENGTH_TUNER_TOOL::TuneDiffPairSkew, PCB_ACTIONS::routerActivateTuneDiffPairSkew.MakeEvent() ); Go( &LENGTH_TUNER_TOOL::TuneDiffPairSkew, PCB_ACTIONS::routerTuneDiffPairSkew.MakeEvent() );
} }

View File

@ -91,29 +91,34 @@ TOOL_ACTION PCB_ACTIONS::routerActivateDiffPair( "pcbnew.InteractiveRouter.DiffP
_( "Run push & shove router (differential pairs)" ), _( "Run push & shove router (differential pairs)" ),
ps_diff_pair_xpm, AF_ACTIVATE ); ps_diff_pair_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::routerActivateSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog", TOOL_ACTION PCB_ACTIONS::routerSettingsDialog( "pcbnew.InteractiveRouter.SettingsDialog",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTING_OPTIONS ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTING_OPTIONS ),
_( "Interactive Router Settings..." ), _( "Interactive Router Settings..." ),
_( "Open Interactive Router settings" ), _( "Open Interactive Router settings" ),
tools_xpm ); tools_xpm );
TOOL_ACTION PCB_ACTIONS::routerActivateDpDimensionsDialog( "pcbnew.InteractiveRouter.DpDimensionsDialog", TOOL_ACTION PCB_ACTIONS::routerDiffPairDialog( "pcbnew.InteractiveRouter.DiffPairDialog",
AS_GLOBAL, 0, AS_GLOBAL, 0,
_( "Differential Pair Dimension Settings..." ), _( "Differential Pair Dimension Settings..." ),
_( "Open Differential Pair Dimension settings" ), _( "Open Differential Pair Dimension settings" ),
ps_diff_pair_gap_xpm ); ps_diff_pair_gap_xpm );
TOOL_ACTION PCB_ACTIONS::routerActivateTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack", TOOL_ACTION PCB_ACTIONS::selectLayerPair( "pcbnew.InteractiveRouter.SelectLayerPair",
AS_GLOBAL, 0,
_( "Set Layer Pair..." ), _( "Change active layer pair for routing" ),
select_layer_pair_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::routerTuneSingleTrace( "pcbnew.LengthTuner.TuneSingleTrack",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_SINGLE ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_SINGLE ),
_( "Tune length of a single track" ), "", _( "Tune length of a single track" ), "",
ps_tune_length_xpm, AF_ACTIVATE ); ps_tune_length_xpm, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair", TOOL_ACTION PCB_ACTIONS::routerTuneDiffPair( "pcbnew.LengthTuner.TuneDiffPair",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_DIFF_PAIR ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_DIFF_PAIR ),
_( "Tune length of a differential pair" ), "", _( "Tune length of a differential pair" ), "",
NULL, AF_ACTIVATE ); NULL, AF_ACTIVATE );
TOOL_ACTION PCB_ACTIONS::routerActivateTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew", TOOL_ACTION PCB_ACTIONS::routerTuneDiffPairSkew( "pcbnew.LengthTuner.TuneDiffPairSkew",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_SKEW ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_ROUTE_TUNE_SKEW ),
_( "Tune skew of a differential pair" ), "", _( "Tune skew of a differential pair" ), "",
NULL, AF_ACTIVATE ); NULL, AF_ACTIVATE );
@ -409,7 +414,7 @@ protected:
{ {
bds.UseCustomDiffPairDimensions( true ); bds.UseCustomDiffPairDimensions( true );
TOOL_MANAGER* toolManager = m_frame.GetToolManager(); TOOL_MANAGER* toolManager = m_frame.GetToolManager();
toolManager->RunAction( PCB_ACTIONS::routerActivateDpDimensionsDialog, true ); toolManager->RunAction( PCB_ACTIONS::routerDiffPairDialog, true );
} }
else if( id == ID_POPUP_PCB_SELECT_USE_NETCLASS_DIFFPAIR ) else if( id == ID_POPUP_PCB_SELECT_USE_NETCLASS_DIFFPAIR )
{ {
@ -466,7 +471,7 @@ public:
if( m_mode == PNS::PNS_MODE_ROUTE_DIFF_PAIR ) if( m_mode == PNS::PNS_MODE_ROUTE_DIFF_PAIR )
Add( &m_diffPairMenu ); Add( &m_diffPairMenu );
Add( PCB_ACTIONS::routerActivateSettingsDialog ); Add( PCB_ACTIONS::routerSettingsDialog );
AppendSeparator(); AppendSeparator();
@ -899,10 +904,12 @@ int ROUTER_TOOL::SettingsDialog( const TOOL_EVENT& aEvent )
void ROUTER_TOOL::setTransitions() void ROUTER_TOOL::setTransitions()
{ {
Go( &ROUTER_TOOL::SelectCopperLayerPair, PCB_ACTIONS::selectLayerPair.MakeEvent() );
Go( &ROUTER_TOOL::RouteSingleTrace, PCB_ACTIONS::routerActivateSingle.MakeEvent() ); Go( &ROUTER_TOOL::RouteSingleTrace, PCB_ACTIONS::routerActivateSingle.MakeEvent() );
Go( &ROUTER_TOOL::RouteDiffPair, PCB_ACTIONS::routerActivateDiffPair.MakeEvent() ); Go( &ROUTER_TOOL::RouteDiffPair, PCB_ACTIONS::routerActivateDiffPair.MakeEvent() );
Go( &ROUTER_TOOL::DpDimensionsDialog, PCB_ACTIONS::routerActivateDpDimensionsDialog.MakeEvent() ); Go( &ROUTER_TOOL::DpDimensionsDialog, PCB_ACTIONS::routerDiffPairDialog.MakeEvent() );
Go( &ROUTER_TOOL::SettingsDialog, PCB_ACTIONS::routerActivateSettingsDialog.MakeEvent() ); Go( &ROUTER_TOOL::SettingsDialog, PCB_ACTIONS::routerSettingsDialog.MakeEvent() );
Go( &ROUTER_TOOL::InlineDrag, PCB_ACTIONS::routerInlineDrag.MakeEvent() ); Go( &ROUTER_TOOL::InlineDrag, PCB_ACTIONS::routerInlineDrag.MakeEvent() );
Go( &ROUTER_TOOL::InlineBreakTrack, PCB_ACTIONS::inlineBreakTrack.MakeEvent() ); Go( &ROUTER_TOOL::InlineBreakTrack, PCB_ACTIONS::inlineBreakTrack.MakeEvent() );

View File

@ -40,6 +40,7 @@ public:
bool CanInlineDrag(); bool CanInlineDrag();
int InlineDrag( const TOOL_EVENT& aEvent ); int InlineDrag( const TOOL_EVENT& aEvent );
int SelectCopperLayerPair( const TOOL_EVENT& aEvent );
// TODO make this private? // TODO make this private?
int DpDimensionsDialog( const TOOL_EVENT& aEvent ); int DpDimensionsDialog( const TOOL_EVENT& aEvent );
int SettingsDialog( const TOOL_EVENT& aEvent ); int SettingsDialog( const TOOL_EVENT& aEvent );

View File

@ -34,6 +34,7 @@
#include <widgets/layer_box_selector.h> #include <widgets/layer_box_selector.h>
#include <class_board.h> #include <class_board.h>
#include <dialogs/dialog_layer_selection_base.h> #include <dialogs/dialog_layer_selection_base.h>
#include <router/router_tool.h>
// Column position by function: // Column position by function:
@ -256,12 +257,11 @@ private:
}; };
void PCB_BASE_FRAME::SelectCopperLayerPair() int ROUTER_TOOL::SelectCopperLayerPair( const TOOL_EVENT& aEvent )
{ {
PCB_SCREEN* screen = GetScreen(); PCB_SCREEN* screen = frame()->GetScreen();
SELECT_COPPER_LAYERS_PAIR_DIALOG dlg( this, GetBoard(), SELECT_COPPER_LAYERS_PAIR_DIALOG dlg( frame(), frame()->GetBoard(), screen->m_Route_Layer_TOP,
screen->m_Route_Layer_TOP,
screen->m_Route_Layer_BOTTOM ); screen->m_Route_Layer_BOTTOM );
if( dlg.ShowModal() == wxID_OK ) if( dlg.ShowModal() == wxID_OK )
@ -271,8 +271,10 @@ void PCB_BASE_FRAME::SelectCopperLayerPair()
// select the same layer for both layers is allowed (normal in some boards) // select the same layer for both layers is allowed (normal in some boards)
// but could be a mistake. So display an info message // but could be a mistake. So display an info message
if( screen->m_Route_Layer_TOP == screen->m_Route_Layer_BOTTOM ) if( screen->m_Route_Layer_TOP == screen->m_Route_Layer_BOTTOM )
DisplayInfoMessage( this, _( "Warning: top and bottom layers are same." ) ); DisplayInfoMessage( frame(), _( "Warning: top and bottom layers are same." ) );
} }
return 0;
} }

View File

@ -177,21 +177,10 @@ void PCB_EDIT_FRAME::PrepareLayerIndicator()
switch( s_BitmapLayerIcon[ii][jj] ) switch( s_BitmapLayerIcon[ii][jj] )
{ {
default: default:
case 0: case 0: pen.SetColour( active_layer_color.ToColour() ); break;
pen.SetColour( active_layer_color.ToColour() ); case 1: pen.SetColour( Route_Layer_TOP_color.ToColour() ); break;
break; case 2: pen.SetColour( Route_Layer_BOTTOM_color.ToColour() ); break;
case 3: pen.SetColour( via_color.ToColour() ); break;
case 1:
pen.SetColour( Route_Layer_TOP_color.ToColour() );
break;
case 2:
pen.SetColour( Route_Layer_BOTTOM_color.ToColour() );
break;
case 3:
pen.SetColour( via_color.ToColour() );
break;
} }
buttonColor = s_BitmapLayerIcon[ii][jj]; buttonColor = s_BitmapLayerIcon[ii][jj];
@ -366,16 +355,11 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
// Tools to show/hide toolbars: // Tools to show/hide toolbars:
KiScaledSeparator( m_optionsToolBar, this ); KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_MANAGE_LAYERS_VERTICAL_TOOLBAR,
wxEmptyString, wxEmptyString, KiScaledBitmap( layers_manager_xpm, this ),
KiScaledBitmap( layers_manager_xpm, this ), HELP_SHOW_HIDE_LAYERMANAGER, wxITEM_CHECK );
HELP_SHOW_HIDE_LAYERMANAGER,
wxITEM_CHECK );
m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE, m_optionsToolBar->AddTool( ID_TB_OPTIONS_SHOW_EXTRA_VERTICAL_TOOLBAR_MICROWAVE,
wxEmptyString, wxEmptyString, KiScaledBitmap( mw_toolbar_xpm, this ),
KiScaledBitmap( mw_toolbar_xpm, this ), HELP_SHOW_HIDE_MICROWAVE_TOOLS, wxITEM_CHECK );
HELP_SHOW_HIDE_MICROWAVE_TOOLS,
wxITEM_CHECK );
KiScaledSeparator( m_optionsToolBar, this ); KiScaledSeparator( m_optionsToolBar, this );
m_optionsToolBar->Realize(); m_optionsToolBar->Realize();
@ -495,10 +479,8 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
// Creates box to display and choose tracks widths: // Creates box to display and choose tracks widths:
if( m_SelTrackWidthBox == nullptr ) if( m_SelTrackWidthBox == nullptr )
m_SelTrackWidthBox = new wxChoice( m_auxiliaryToolBar, m_SelTrackWidthBox = new wxChoice( m_auxiliaryToolBar, ID_AUX_TOOLBAR_PCB_TRACK_WIDTH,
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH, wxDefaultPosition, wxDefaultSize, 0, NULL );
wxDefaultPosition, wxDefaultSize,
0, NULL );
UpdateTrackWidthSelectBox( m_SelTrackWidthBox ); UpdateTrackWidthSelectBox( m_SelTrackWidthBox );
m_auxiliaryToolBar->AddControl( m_SelTrackWidthBox ); m_auxiliaryToolBar->AddControl( m_SelTrackWidthBox );
@ -506,18 +488,15 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
// Creates box to display and choose vias diameters: // Creates box to display and choose vias diameters:
if( m_SelViaSizeBox == nullptr ) if( m_SelViaSizeBox == nullptr )
m_SelViaSizeBox = new wxChoice( m_auxiliaryToolBar, m_SelViaSizeBox = new wxChoice( m_auxiliaryToolBar, ID_AUX_TOOLBAR_PCB_VIA_SIZE,
ID_AUX_TOOLBAR_PCB_VIA_SIZE, wxDefaultPosition, wxDefaultSize, 0, NULL );
wxDefaultPosition, wxDefaultSize,
0, NULL );
UpdateViaSizeSelectBox( m_SelViaSizeBox ); UpdateViaSizeSelectBox( m_SelViaSizeBox );
m_auxiliaryToolBar->AddControl( m_SelViaSizeBox ); m_auxiliaryToolBar->AddControl( m_SelViaSizeBox );
KiScaledSeparator( m_auxiliaryToolBar, this ); KiScaledSeparator( m_auxiliaryToolBar, this );
// Creates box to display and choose strategy to handle tracks an vias sizes: // Creates box to display and choose strategy to handle tracks an vias sizes:
m_auxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, m_auxiliaryToolBar->AddTool( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH, wxEmptyString,
wxEmptyString,
KiScaledBitmap( auto_track_width_xpm, this ), KiScaledBitmap( auto_track_width_xpm, this ),
_( "Auto track width: when starting on an existing track " _( "Auto track width: when starting on an existing track "
"use its width\notherwise, use current width setting" ), "use its width\notherwise, use current width setting" ),
@ -527,10 +506,8 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
KiScaledSeparator( m_auxiliaryToolBar, this ); KiScaledSeparator( m_auxiliaryToolBar, this );
if( m_gridSelectBox == nullptr ) if( m_gridSelectBox == nullptr )
m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, m_gridSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_GRID_SELECT,
ID_ON_GRID_SELECT, wxDefaultPosition, wxDefaultSize, 0, NULL );
wxDefaultPosition, wxDefaultSize,
0, NULL );
UpdateGridSelectBox(); UpdateGridSelectBox();
@ -540,10 +517,8 @@ void PCB_EDIT_FRAME::ReCreateAuxiliaryToolbar()
KiScaledSeparator( m_auxiliaryToolBar, this ); KiScaledSeparator( m_auxiliaryToolBar, this );
if( m_zoomSelectBox == nullptr ) if( m_zoomSelectBox == nullptr )
m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, m_zoomSelectBox = new wxChoice( m_auxiliaryToolBar, ID_ON_ZOOM_SELECT,
ID_ON_ZOOM_SELECT, wxDefaultPosition, wxDefaultSize, 0, NULL );
wxDefaultPosition, wxDefaultSize,
0, NULL );
updateZoomSelectBox(); updateZoomSelectBox();
m_auxiliaryToolBar->AddControl( m_zoomSelectBox ); m_auxiliaryToolBar->AddControl( m_zoomSelectBox );
@ -571,11 +546,9 @@ void PCB_EDIT_FRAME::UpdateTrackWidthSelectBox( wxChoice* aTrackWidthSelectBox,
double value_mm = To_User_Unit( MILLIMETRES, size ); double value_mm = To_User_Unit( MILLIMETRES, size );
if( mmFirst ) if( mmFirst )
msg.Printf( _( "Track: %.3f mm (%.2f mils)" ), msg.Printf( _( "Track: %.3f mm (%.2f mils)" ), value_mm, valueMils );
value_mm, valueMils );
else else
msg.Printf( _( "Track: %.2f mils (%.3f mm)" ), msg.Printf( _( "Track: %.2f mils (%.3f mm)" ), valueMils, value_mm );
valueMils, value_mm );
// Mark the netclass track width value (the first in list) // Mark the netclass track width value (the first in list)
if( ii == 0 ) if( ii == 0 )
@ -738,12 +711,6 @@ bool PCB_EDIT_FRAME::MicrowaveToolbarShown()
} }
void PCB_EDIT_FRAME::OnUpdateVerticalToolbar( wxUpdateUIEvent& aEvent )
{
if( aEvent.GetEventObject() == m_drawToolBar || aEvent.GetEventObject() == m_mainToolBar )
aEvent.Check( GetToolId() == aEvent.GetId() );
}
void PCB_EDIT_FRAME::OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent ) void PCB_EDIT_FRAME::OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent )
{ {
if( aEvent.GetEventObject() == m_microWaveToolBar ) if( aEvent.GetEventObject() == m_microWaveToolBar )

View File

@ -134,28 +134,6 @@ TOOL_ACTION PCB_ACTIONS::removeAlt( "pcbnew.InteractiveEdit.removeAlt",
_( "Delete Full Track" ), _( "Deletes selected item(s) and copper connections" ), _( "Delete Full Track" ), _( "Deletes selected item(s) and copper connections" ),
delete_xpm, AF_NONE, (void*) REMOVE_FLAGS::ALT ); delete_xpm, AF_NONE, (void*) REMOVE_FLAGS::ALT );
TOOL_ACTION PCB_ACTIONS::updateFootprint( "pcbnew.InteractiveEdit.updateFootprint",
AS_GLOBAL, 0,
_( "Update Footprint..." ),
_( "Update footprint to include any changes from the library" ),
reload_xpm );
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", TOOL_ACTION PCB_ACTIONS::properties( "pcbnew.InteractiveEdit.properties",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_ITEM ), AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_EDIT_ITEM ),
_( "Properties..." ), _( "Displays item properties dialog" ), _( "Properties..." ), _( "Displays item properties dialog" ),
@ -1201,50 +1179,6 @@ void EDIT_TOOL::FootprintFilter( const VECTOR2I&, GENERAL_COLLECTOR& aCollector
} }
int EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
{
SELECTION& selection = m_selectionTool->RequestSelection( FootprintFilter );
MODULE* mod = (selection.Empty() ? nullptr : selection.FirstOfKind<MODULE> () );
bool updateMode = false;
bool currentMode = false;
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
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
// invoke the exchange dialog process
{
DIALOG_EXCHANGE_FOOTPRINTS dialog( frame(), mod, updateMode, currentMode );
dialog.ShowQuasiModal();
}
return 0;
}
int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent ) int EDIT_TOOL::MeasureTool( const TOOL_EVENT& aEvent )
{ {
if( EditingModules() && !frame()->GetModel()) if( EditingModules() && !frame()->GetModel())
@ -1517,10 +1451,6 @@ void EDIT_TOOL::setTransitions()
Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() ); Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
Go( &EDIT_TOOL::EditFpInFpEditor, PCB_ACTIONS::editFootprintInFpEditor.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::MeasureTool, ACTIONS::measureTool.MakeEvent() );
Go( &EDIT_TOOL::copyToClipboard, ACTIONS::copy.MakeEvent() ); Go( &EDIT_TOOL::copyToClipboard, ACTIONS::copy.MakeEvent() );

View File

@ -139,14 +139,6 @@ public:
*/ */
int CreateArray( const TOOL_EVENT& aEvent ); int CreateArray( const TOOL_EVENT& aEvent );
/**
* Function ExchangeFootprints()
*
* Invoke the dialog used to update or exchange the footprints used for
* modules. The mode depends on the PCB_ACTIONS held by the TOOL_EVENT.
*/
int ExchangeFootprints( const TOOL_EVENT& aEvent );
///> Launches a tool to measure between points ///> Launches a tool to measure between points
int MeasureTool( const TOOL_EVENT& aEvent ); int MeasureTool( const TOOL_EVENT& aEvent );

View File

@ -26,18 +26,15 @@
#include "kicad_clipboard.h" #include "kicad_clipboard.h"
#include "selection_tool.h" #include "selection_tool.h"
#include "pcb_actions.h" #include "pcb_actions.h"
#include <core/optional.h> #include <core/optional.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <class_draw_panel_gal.h> #include <class_draw_panel_gal.h>
#include <view/view_controls.h> #include <view/view_controls.h>
#include <view/view_group.h> #include <view/view_group.h>
#include <pcb_painter.h> #include <pcb_painter.h>
#include <origin_viewitem.h> #include <origin_viewitem.h>
#include <status_popup.h> #include <status_popup.h>
#include <footprint_edit_frame.h>
#include <kicad_plugin.h> #include <kicad_plugin.h>
#include <pcbnew_id.h> #include <pcbnew_id.h>
#include <collectors.h> #include <collectors.h>
@ -45,7 +42,6 @@
#include <dialogs/dialog_enum_pads.h> #include <dialogs/dialog_enum_pads.h>
#include <hotkeys.h> #include <hotkeys.h>
#include <bitmaps.h> #include <bitmaps.h>
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <class_board.h> #include <class_board.h>
#include <class_module.h> #include <class_module.h>
@ -97,6 +93,12 @@ void MODULE_EDITOR_TOOLS::Reset( RESET_REASON aReason )
} }
int MODULE_EDITOR_TOOLS::Revert( const TOOL_EVENT& aEvent )
{
getEditFrame<FOOTPRINT_EDIT_FRAME>()->RevertFootprint();
return 0;
}
int MODULE_EDITOR_TOOLS::PlacePad( const TOOL_EVENT& aEvent ) int MODULE_EDITOR_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
{ {
@ -542,6 +544,8 @@ int MODULE_EDITOR_TOOLS::CreatePadFromShapes( const TOOL_EVENT& aEvent )
void MODULE_EDITOR_TOOLS::setTransitions() void MODULE_EDITOR_TOOLS::setTransitions()
{ {
Go( &MODULE_EDITOR_TOOLS::Revert, ACTIONS::revert.MakeEvent() );
Go( &MODULE_EDITOR_TOOLS::PlacePad, PCB_ACTIONS::placePad.MakeEvent() ); Go( &MODULE_EDITOR_TOOLS::PlacePad, PCB_ACTIONS::placePad.MakeEvent() );
Go( &MODULE_EDITOR_TOOLS::CreatePadFromShapes, PCB_ACTIONS::createPadFromShapes.MakeEvent() ); Go( &MODULE_EDITOR_TOOLS::CreatePadFromShapes, PCB_ACTIONS::createPadFromShapes.MakeEvent() );
Go( &MODULE_EDITOR_TOOLS::ExplodePadToShapes, PCB_ACTIONS::explodePadToShapes.MakeEvent() ); Go( &MODULE_EDITOR_TOOLS::ExplodePadToShapes, PCB_ACTIONS::explodePadToShapes.MakeEvent() );

View File

@ -49,6 +49,8 @@ public:
/// @copydoc TOOL_INTERACTIVE::Reset() /// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override; void Reset( RESET_REASON aReason ) override;
int Revert( const TOOL_EVENT& aEvent );
/** /**
* Function PlacePad() * Function PlacePad()
* Places a pad in module editor. * Places a pad in module editor.
@ -82,7 +84,6 @@ public:
*/ */
int ExplodePadToShapes( const TOOL_EVENT& aEvent ); int ExplodePadToShapes( const TOOL_EVENT& aEvent );
///> Sets up handlers for various events. ///> Sets up handlers for various events.
void setTransitions() override; void setTransitions() override;

View File

@ -0,0 +1,239 @@
/*
* 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 <bitmaps.h>
#include <class_zone.h>
#include <tool/tool_manager.h>
#include <tools/pcb_actions.h>
#include <tools/selection_tool.h>
#include <tools/edit_tool.h>
#include <dialogs/dialog_track_via_properties.h>
#include <dialogs/dialog_exchange_footprints.h>
#include <dialogs/dialog_swap_layers.h>
#include <tools/global_edit_tool.h>
#include <board_commit.h>
TOOL_ACTION PCB_ACTIONS::updateFootprint( "pcbnew.GlobalEdit.updateFootprint",
AS_GLOBAL, 0,
_( "Update Footprint..." ),
_( "Update footprint to include any changes from the library" ),
reload_xpm );
TOOL_ACTION PCB_ACTIONS::updateFootprints( "pcbnew.GlobalEdit.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.GlobalEdit.changeFootprint",
AS_GLOBAL, 0,
_( "Change Footprint..." ), _( "Assign a different footprint from the library" ),
exchange_xpm );
TOOL_ACTION PCB_ACTIONS::changeFootprints( "pcbnew.GlobalEdit.changeFootprints",
AS_GLOBAL, 0,
_( "Change Footprints..." ), _( "Assign different footprints from the library" ),
exchange_xpm );
TOOL_ACTION PCB_ACTIONS::swapLayers( "pcbnew.GlobalEdit.swapLayers",
AS_GLOBAL, 0,
_( "Swap Layers..." ), _( "Move tracks or drawings from one layer to another" ),
swap_layer_xpm );
TOOL_ACTION PCB_ACTIONS::editTracksAndVias( "pcbnew.GlobalEdit.editTracksAndVias",
AS_GLOBAL, 0,
_( "Edit Track && Via Properties..." ), "",
width_track_via_xpm );
TOOL_ACTION PCB_ACTIONS::editTextAndGraphics( "pcbnew.GlobalEdit.editTextAndGraphics",
AS_GLOBAL, 0,
_( "Edit Text && Graphic Properties..." ), "",
reset_text_xpm );
TOOL_ACTION PCB_ACTIONS::globalDeletions( "pcbnew.GlobalEdit.globalDeletions",
AS_GLOBAL, 0,
_( "Global Deletions..." ),
_( "Delete tracks, footprints and graphic items from board" ),
general_deletions_xpm );
TOOL_ACTION PCB_ACTIONS::cleanupTracksAndVias( "pcbnew.GlobalEdit.cleanupTracksAndVias",
AS_GLOBAL, 0,
_( "Cleanup Tracks && Vias..." ),
_( "Clean stubs, vias, delete break points or unconnected tracks" ),
delete_xpm );
GLOBAL_EDIT_TOOL::GLOBAL_EDIT_TOOL() :
PCB_TOOL_BASE( "pcbnew.GlobalEdit" )
{
}
void GLOBAL_EDIT_TOOL::Reset( RESET_REASON aReason )
{
if( aReason != RUN )
m_commit.reset( new BOARD_COMMIT( this ) );
}
bool GLOBAL_EDIT_TOOL::Init()
{
// Find the selection tool, so they can cooperate
m_selectionTool = static_cast<SELECTION_TOOL*>( m_toolMgr->FindTool( "pcbnew.InteractiveSelection" ) );
wxASSERT_MSG( m_selectionTool, "pcbnew.InteractiveSelection tool is not available" );
return true;
}
int GLOBAL_EDIT_TOOL::ExchangeFootprints( const TOOL_EVENT& aEvent )
{
SELECTION& selection = m_selectionTool->RequestSelection( EDIT_TOOL::FootprintFilter );
MODULE* mod = (selection.Empty() ? nullptr : selection.FirstOfKind<MODULE> () );
bool updateMode = false;
bool currentMode = false;
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
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
// invoke the exchange dialog process
{
DIALOG_EXCHANGE_FOOTPRINTS dialog( frame(), mod, updateMode, currentMode );
dialog.ShowQuasiModal();
}
return 0;
}
bool GLOBAL_EDIT_TOOL::swapBoardItem( BOARD_ITEM* aItem, PCB_LAYER_ID* new_layer )
{
if( new_layer[ aItem->GetLayer() ] != aItem->GetLayer() )
{
m_commit->Modify( aItem );
aItem->SetLayer( new_layer[ aItem->GetLayer() ] );
frame()->GetGalCanvas()->GetView()->Update( aItem, KIGFX::GEOMETRY );
return true;
}
return false;
}
int GLOBAL_EDIT_TOOL::SwapLayers( const TOOL_EVENT& aEvent )
{
PCB_LAYER_ID new_layer[PCB_LAYER_ID_COUNT];
DIALOG_SWAP_LAYERS dlg( frame(), new_layer );
if( dlg.ShowModal() != wxID_OK )
return 0;
bool hasChanges = false;
// Change tracks.
for( auto segm : frame()->GetBoard()->Tracks() )
{
if( segm->Type() == PCB_VIA_T )
{
VIA* via = (VIA*) segm;
PCB_LAYER_ID top_layer, bottom_layer;
if( via->GetViaType() == VIA_THROUGH )
continue;
via->LayerPair( &top_layer, &bottom_layer );
if( new_layer[bottom_layer] != bottom_layer || new_layer[top_layer] != top_layer )
{
m_commit->Modify( via );
via->SetLayerPair( new_layer[top_layer], new_layer[bottom_layer] );
frame()->GetGalCanvas()->GetView()->Update( via, KIGFX::GEOMETRY );
hasChanges = true;
}
}
else
{
hasChanges |= swapBoardItem( segm, new_layer );
}
}
for( BOARD_ITEM* zone : frame()->GetBoard()->Zones() )
hasChanges |= swapBoardItem( zone, new_layer );
for( BOARD_ITEM* drawing : frame()->GetBoard()->Drawings() )
hasChanges |= swapBoardItem( drawing, new_layer );
if( hasChanges )
{
frame()->OnModify();
m_commit->Push( "Layers moved" );
frame()->GetGalCanvas()->Refresh();
}
return 0;
}
void GLOBAL_EDIT_TOOL::setTransitions()
{
Go( &GLOBAL_EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::updateFootprint.MakeEvent() );
Go( &GLOBAL_EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::updateFootprints.MakeEvent() );
Go( &GLOBAL_EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::changeFootprint.MakeEvent() );
Go( &GLOBAL_EDIT_TOOL::ExchangeFootprints, PCB_ACTIONS::changeFootprints.MakeEvent() );
Go( &GLOBAL_EDIT_TOOL::SwapLayers, PCB_ACTIONS::swapLayers.MakeEvent() );
Go( &GLOBAL_EDIT_TOOL::EditTracksAndVias, PCB_ACTIONS::editTracksAndVias.MakeEvent() );
Go( &GLOBAL_EDIT_TOOL::EditTextAndGraphics, PCB_ACTIONS::editTextAndGraphics.MakeEvent() );
Go( &GLOBAL_EDIT_TOOL::GlobalDeletions, PCB_ACTIONS::globalDeletions.MakeEvent() );
Go( &GLOBAL_EDIT_TOOL::CleanupTracksAndVias, PCB_ACTIONS::cleanupTracksAndVias.MakeEvent() );
}

View File

@ -0,0 +1,75 @@
/*
* 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
*/
#ifndef GLOBAL_EDIT_TOOL_H
#define GLOBAL_EDIT_TOOL_H
#include <math/vector2d.h>
#include <tools/pcb_tool_base.h>
#include <tools/selection_tool.h>
#include <status_popup.h>
class BOARD_COMMIT;
class BOARD_ITEM;
class CONNECTIVITY_DATA;
class GLOBAL_EDIT_TOOL : public PCB_TOOL_BASE
{
public:
GLOBAL_EDIT_TOOL();
/// @copydoc TOOL_INTERACTIVE::Reset()
void Reset( RESET_REASON aReason ) override;
/// @copydoc TOOL_INTERACTIVE::Init()
bool Init() override;
/**
* Function ExchangeFootprints()
*
* Invoke the dialog used to update or exchange the footprints used for
* modules. The mode depends on the PCB_ACTIONS held by the TOOL_EVENT.
*/
int ExchangeFootprints( const TOOL_EVENT& aEvent );
int SwapLayers( const TOOL_EVENT& aEvent );
int EditTracksAndVias( const TOOL_EVENT& aEvent );
int EditTextAndGraphics( const TOOL_EVENT& aEvent );
int GlobalDeletions( const TOOL_EVENT& aEvent );
int CleanupTracksAndVias( const TOOL_EVENT& aEvent );
private:
bool swapBoardItem( BOARD_ITEM* aItem, PCB_LAYER_ID* new_layer );
///> Sets up handlers for various events.
void setTransitions() override;
private:
SELECTION_TOOL* m_selectionTool;
std::unique_ptr<BOARD_COMMIT> m_commit;
};
#endif

View File

@ -33,42 +33,12 @@ OPT<TOOL_EVENT> PCB_ACTIONS::TranslateLegacyId( int aId )
{ {
switch( aId ) switch( aId )
{ {
case ID_DIFF_PAIR_BUTT:
return PCB_ACTIONS::routerActivateDiffPair.MakeEvent();
case ID_TUNE_SINGLE_TRACK_LEN_BUTT:
return PCB_ACTIONS::routerActivateTuneSingleTrace.MakeEvent();
case ID_TUNE_DIFF_PAIR_LEN_BUTT:
return PCB_ACTIONS::routerActivateTuneDiffPair.MakeEvent();
case ID_TUNE_DIFF_PAIR_SKEW_BUTT:
return PCB_ACTIONS::routerActivateTuneDiffPairSkew.MakeEvent();
case ID_MENU_INTERACTIVE_ROUTER_SETTINGS:
return PCB_ACTIONS::routerActivateSettingsDialog.MakeEvent();
case ID_MENU_DIFF_PAIR_DIMENSIONS:
return PCB_ACTIONS::routerActivateDpDimensionsDialog.MakeEvent();
case ID_GEN_IMPORT_GRAPHICS_FILE: case ID_GEN_IMPORT_GRAPHICS_FILE:
return PCB_ACTIONS::placeImportedGraphics.MakeEvent(); return PCB_ACTIONS::placeImportedGraphics.MakeEvent();
case ID_POPUP_GRID_NEXT:
return ACTIONS::gridNext.MakeEvent();
case ID_POPUP_GRID_PREV:
return ACTIONS::gridPrev.MakeEvent();
case ID_POPUP_PCB_GET_AND_MOVE_MODULE_REQUEST:
return PCB_ACTIONS::findMove.MakeEvent();
case ID_NO_TOOL_SELECTED: case ID_NO_TOOL_SELECTED:
return PCB_ACTIONS::selectionTool.MakeEvent(); return PCB_ACTIONS::selectionTool.MakeEvent();
case ID_APPEND_FILE:
return PCB_ACTIONS::appendBoard.MakeEvent();
case ID_PCB_MUWAVE_TOOL_GAP_CMD: case ID_PCB_MUWAVE_TOOL_GAP_CMD:
return PCB_ACTIONS::microwaveCreateGap.MakeEvent(); return PCB_ACTIONS::microwaveCreateGap.MakeEvent();

View File

@ -113,18 +113,12 @@ public:
/// Activation of the duplication tool with incrementing (e.g. pad number) /// Activation of the duplication tool with incrementing (e.g. pad number)
static TOOL_ACTION duplicateIncrement; 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 changeFootprint;
static TOOL_ACTION changeFootprints;
/// Deleting a BOARD_ITEM /// Deleting a BOARD_ITEM
static TOOL_ACTION remove; static TOOL_ACTION remove;
static TOOL_ACTION removeAlt; static TOOL_ACTION removeAlt;
static TOOL_ACTION selectLayerPair;
/// Break a single track into two segments at the cursor /// Break a single track into two segments at the cursor
static TOOL_ACTION breakTrack; static TOOL_ACTION breakTrack;
@ -170,17 +164,17 @@ public:
static TOOL_ACTION routerActivateDiffPair; static TOOL_ACTION routerActivateDiffPair;
/// Activation of the Push and Shove router (tune single line mode) /// Activation of the Push and Shove router (tune single line mode)
static TOOL_ACTION routerActivateTuneSingleTrace; static TOOL_ACTION routerTuneSingleTrace;
/// Activation of the Push and Shove router (diff pair tuning mode) /// Activation of the Push and Shove router (diff pair tuning mode)
static TOOL_ACTION routerActivateTuneDiffPair; static TOOL_ACTION routerTuneDiffPair;
/// Activation of the Push and Shove router (skew tuning mode) /// Activation of the Push and Shove router (skew tuning mode)
static TOOL_ACTION routerActivateTuneDiffPairSkew; static TOOL_ACTION routerTuneDiffPairSkew;
/// Activation of the Push and Shove settings dialogs /// Activation of the Push and Shove settings dialogs
static TOOL_ACTION routerActivateSettingsDialog; static TOOL_ACTION routerSettingsDialog;
static TOOL_ACTION routerActivateDpDimensionsDialog; static TOOL_ACTION routerDiffPairDialog;
/// Activation of the Push and Shove router (inline dragging mode) /// Activation of the Push and Shove router (inline dragging mode)
@ -238,6 +232,8 @@ public:
static TOOL_ACTION layerChanged; // notification static TOOL_ACTION layerChanged; // notification
static TOOL_ACTION flipBoard;
// Track & via size control // Track & via size control
static TOOL_ACTION trackWidthInc; static TOOL_ACTION trackWidthInc;
static TOOL_ACTION trackWidthDec; static TOOL_ACTION trackWidthDec;
@ -256,6 +252,18 @@ public:
/// Duplicate zone onto another layer /// Duplicate zone onto another layer
static TOOL_ACTION zoneDuplicate; static TOOL_ACTION zoneDuplicate;
// Global edit tool
static TOOL_ACTION editTracksAndVias;
static TOOL_ACTION editTextAndGraphics;
static TOOL_ACTION globalDeletions;
static TOOL_ACTION cleanupTracksAndVias;
static TOOL_ACTION updateFootprint;
static TOOL_ACTION updateFootprints;
static TOOL_ACTION changeFootprint;
static TOOL_ACTION changeFootprints;
static TOOL_ACTION swapLayers;
static TOOL_ACTION listNets; static TOOL_ACTION listNets;
static TOOL_ACTION runDRC; static TOOL_ACTION runDRC;
static TOOL_ACTION updatePcbFromSchematic; static TOOL_ACTION updatePcbFromSchematic;

View File

@ -176,6 +176,11 @@ TOOL_ACTION PCB_ACTIONS::showPythonConsole( "pcbnew.Control.showPythonConsole",
_( "Scripting Console" ), _( "Show the Python scripting console" ), _( "Scripting Console" ), _( "Show the Python scripting console" ),
py_script_xpm ); py_script_xpm );
TOOL_ACTION PCB_ACTIONS::flipBoard( "pcbnew.Control.flipBoard",
AS_GLOBAL, 0,
_( "Flip Board View" ), _( "Flip (mirror) the board view" ),
flip_board_xpm );
class ZONE_CONTEXT_MENU : public ACTION_MENU class ZONE_CONTEXT_MENU : public ACTION_MENU
{ {
@ -1383,6 +1388,15 @@ void PCB_EDITOR_CONTROL::calculateSelectionRatsnest()
} }
int PCB_EDITOR_CONTROL::FlipPcbView( const TOOL_EVENT& aEvent )
{
view()->SetMirror( !view()->IsMirroredX(), false );
view()->RecacheAllItems();
frame()->Refresh();
return 0;
}
void PCB_EDITOR_CONTROL::setTransitions() void PCB_EDITOR_CONTROL::setTransitions()
{ {
Go( &PCB_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::New, ACTIONS::doNew.MakeEvent() );
@ -1430,6 +1444,7 @@ void PCB_EDITOR_CONTROL::setTransitions()
Go( &PCB_EDITOR_CONTROL::ListNets, PCB_ACTIONS::listNets.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::ListNets, PCB_ACTIONS::listNets.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::UpdatePCBFromSchematic, ACTIONS::updatePcbFromSchematic.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::UpdatePCBFromSchematic, ACTIONS::updatePcbFromSchematic.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::TogglePythonConsole, PCB_ACTIONS::showPythonConsole.MakeEvent() ); Go( &PCB_EDITOR_CONTROL::TogglePythonConsole, PCB_ACTIONS::showPythonConsole.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::FlipPcbView, PCB_ACTIONS::flipBoard.MakeEvent() );
} }

View File

@ -132,6 +132,8 @@ public:
///> Shows local ratsnest of a component ///> Shows local ratsnest of a component
int LocalRatsnestTool( const TOOL_EVENT& aEvent ); int LocalRatsnestTool( const TOOL_EVENT& aEvent );
int FlipPcbView( const TOOL_EVENT& aEvent );
int ListNets( const TOOL_EVENT& aEvent ); int ListNets( const TOOL_EVENT& aEvent );
private: private:

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2004-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -23,12 +23,6 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/**
* @file tracks_cleaner.cpp
* @brief functions to clean tracks: remove null length and redundant segments
*/
#include <fctsys.h> #include <fctsys.h>
#include <pcb_edit_frame.h> #include <pcb_edit_frame.h>
#include <pcbnew.h> #include <pcbnew.h>
@ -39,20 +33,19 @@
#include <board_commit.h> #include <board_commit.h>
#include <connectivity/connectivity_algo.h> #include <connectivity/connectivity_algo.h>
#include <connectivity/connectivity_data.h> #include <connectivity/connectivity_data.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tools/pcb_actions.h> #include <tools/pcb_actions.h>
#include <tools/global_edit_tool.h>
#include <tracks_cleaner.h> #include <tracks_cleaner.h>
/* Install the cleanup dialog frame to know what should be cleaned /* Install the cleanup dialog frame to know what should be cleaned
*/ */
void PCB_EDIT_FRAME::Clean_Pcb() int GLOBAL_EDIT_TOOL::CleanupTracksAndVias( const TOOL_EVENT& aEvent )
{ {
DIALOG_CLEANUP_TRACKS_AND_VIAS dlg( this ); DIALOG_CLEANUP_TRACKS_AND_VIAS dlg( frame() );
dlg.ShowModal(); dlg.ShowModal();
return 0;
} }
@ -104,8 +97,7 @@ bool TRACKS_CLEANER::CleanupBoard( bool aDryRun, DRC_LIST* aItemsList, bool aRem
modified = true; modified = true;
// Removed tracks can leave aligned segments // Removed tracks can leave aligned segments
// (when a T was formed by tracks and the "vertical" segment // (when a T was formed by tracks and the "vertical" segment is removed)
// is removed)
if( aMergeSegments ) if( aMergeSegments )
cleanupSegments(); cleanupSegments();
} }
@ -180,9 +172,9 @@ bool TRACKS_CLEANER::cleanupVias()
if( via1->GetStart() != via1->GetEnd() ) if( via1->GetStart() != via1->GetEnd() )
via1->SetEnd( via1->GetStart() ); via1->SetEnd( via1->GetStart() );
/* To delete through Via on THT pads at same location // To delete through Via on THT pads at same location
* Examine the list of connected pads: // Examine the list of connected pads:
* if one through pad is found, the via can be removed */ // if one through pad is found, the via can be removed
const auto pads = m_brd->GetConnectivity()->GetConnectedPads( via1 ); const auto pads = m_brd->GetConnectivity()->GetConnectedPads( via1 );
for( const auto pad : pads ) for( const auto pad : pads )
@ -282,18 +274,15 @@ bool TRACKS_CLEANER::deleteDanglingTracks()
{ {
item_erased = false; item_erased = false;
for( auto track_it = m_brd->Tracks().begin(); track_it != m_brd->Tracks().end(); for( TRACK* track : m_brd->Tracks() )
track_it++ )
{ {
auto track = *track_it;
bool flag_erase = false; // Start without a good reason to erase it bool flag_erase = false; // Start without a good reason to erase it
if( track->Type() != PCB_TRACE_T ) if( track->Type() != PCB_TRACE_T )
continue; continue;
/* if a track endpoint is not connected to a pad, test if // if a track endpoint is not connected to a pad, test if
* the endpoint is connected to another track or to a zone. // the endpoint is connected to another track or to a zone.
*/
if( !testTrackHasPad( track ) ) if( !testTrackHasPad( track ) )
flag_erase |= testTrackEndpointDangling( track ); flag_erase |= testTrackEndpointDangling( track );
@ -321,7 +310,6 @@ bool TRACKS_CLEANER::deleteDanglingTracks()
} }
} while( item_erased ); } while( item_erased );
return modified; return modified;
} }