From c7bfa9857e8ebd7a1d5a0599ffd1e8e57b7c1b5f Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Sun, 16 Jun 2019 14:42:40 +0100 Subject: [PATCH] Use more reflective naming of what the tool does. --- eeschema/CMakeLists.txt | 2 +- eeschema/menubar.cpp | 4 +- eeschema/sch_edit_frame.cpp | 19 +-------- eeschema/sch_edit_frame.h | 3 +- eeschema/sheet.cpp | 2 +- eeschema/tools/ee_actions.h | 1 + eeschema/tools/ee_selection_tool.cpp | 6 +-- eeschema/tools/sch_edit_tool.cpp | 6 +-- eeschema/tools/sch_editor_control.cpp | 20 ++++++++- eeschema/tools/sch_editor_control.h | 1 + ...us_tool.cpp => sch_line_wire_bus_tool.cpp} | 42 +++++++++---------- ...re_bus_tool.h => sch_line_wire_bus_tool.h} | 12 +++--- eeschema/tools/sch_move_tool.cpp | 4 +- include/id.h | 3 -- 14 files changed, 62 insertions(+), 63 deletions(-) rename eeschema/tools/{sch_wire_bus_tool.cpp => sch_line_wire_bus_tool.cpp} (95%) rename eeschema/tools/{sch_wire_bus_tool.h => sch_line_wire_bus_tool.h} (92%) diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index ca86d46080..6850a16d35 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -234,7 +234,7 @@ set( EESCHEMA_SRCS tools/sch_drawing_tools.cpp tools/sch_edit_tool.cpp tools/sch_editor_control.cpp - tools/sch_wire_bus_tool.cpp + tools/sch_line_wire_bus_tool.cpp tools/sch_move_tool.cpp ) diff --git a/eeschema/menubar.cpp b/eeschema/menubar.cpp index fdf40f9681..e2a72deacf 100644 --- a/eeschema/menubar.cpp +++ b/eeschema/menubar.cpp @@ -112,9 +112,7 @@ void SCH_EDIT_FRAME::ReCreateMenuBar() submenuExport->Add( _( "Drawing to Clipboard" ), _( "Export drawings to clipboard" ), ID_GEN_COPY_SHEET_TO_CLIPBOARD, copy_xpm ); - - submenuExport->Add( _( "Netlist..." ), _( "Export netlist file" ), - ID_GET_NETLIST, netlist_xpm ); + submenuExport->Add( EE_ACTIONS::exportNetlist ); fileMenu->AddMenu( submenuExport, EE_CONDITIONS::ShowAlways ); diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index 3e8739da0f..b7c942f9a1 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -64,7 +64,7 @@ #include #include #include -#include +#include #include #include #include @@ -227,7 +227,6 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME ) EVT_TOOL( ID_RESCUE_CACHED, SCH_EDIT_FRAME::OnRescueProject ) EVT_MENU( ID_REMAP_SYMBOLS, SCH_EDIT_FRAME::OnRemapSymbols ) - EVT_TOOL( ID_GET_NETLIST, SCH_EDIT_FRAME::OnCreateNetlist ) EVT_TOOL( ID_BACKANNO_ITEMS, SCH_EDIT_FRAME::OnLoadCmpToFootprintLinkFile ) EVT_MENU( ID_GRID_SETTINGS, SCH_BASE_FRAME::OnGridSettings ) END_EVENT_TABLE() @@ -344,7 +343,7 @@ void SCH_EDIT_FRAME::setupTools() m_toolManager->RegisterTool( new EE_SELECTION_TOOL ); m_toolManager->RegisterTool( new EE_PICKER_TOOL ); m_toolManager->RegisterTool( new SCH_DRAWING_TOOLS ); - m_toolManager->RegisterTool( new SCH_WIRE_BUS_TOOL ); + m_toolManager->RegisterTool( new SCH_LINE_WIRE_BUS_TOOL ); m_toolManager->RegisterTool( new SCH_MOVE_TOOL ); m_toolManager->RegisterTool( new SCH_EDIT_TOOL ); m_toolManager->RegisterTool( new EE_INSPECTION_TOOL ); @@ -673,20 +672,6 @@ void SCH_EDIT_FRAME::OnUpdatePCB( wxCommandEvent& event ) } -void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event ) -{ - int result; - - do - { - result = InvokeDialogNetList( this ); - - // If a plugin is removed or added, rebuild and reopen the new dialog - - } while( result == NET_PLUGIN_CHANGE ); -} - - wxFindReplaceData* SCH_EDIT_FRAME::GetFindReplaceData() { if( m_findReplaceDialog && m_findReplaceDialog->IsVisible() diff --git a/eeschema/sch_edit_frame.h b/eeschema/sch_edit_frame.h index 68e437489c..af1e2d01a7 100644 --- a/eeschema/sch_edit_frame.h +++ b/eeschema/sch_edit_frame.h @@ -563,7 +563,7 @@ public: * Use the wxWidgets print code to draw an image of the current sheet onto * the clipboard. */ - void DrawCurrentSheetToClipboard( wxCommandEvent& event ); + void DrawCurrentSheetToClipboard(); /** * Called when modifying the page settings. @@ -753,7 +753,6 @@ private: void setupTools(); void OnExit( wxCommandEvent& event ); - void OnCreateNetlist( wxCommandEvent& event ); void OnLoadFile( wxCommandEvent& event ); void OnLoadCmpToFootprintLinkFile( wxCommandEvent& event ); diff --git a/eeschema/sheet.cpp b/eeschema/sheet.cpp index f23eebee91..3a17162dfb 100644 --- a/eeschema/sheet.cpp +++ b/eeschema/sheet.cpp @@ -425,7 +425,7 @@ SCH_HIERLABEL* SCH_EDIT_FRAME::ImportHierLabel( SCH_SHEET* aSheet ) * Copy the current page or block to the clipboard, to export drawings to other applications * (word processing ...) This is not suitable for copy command within Eeschema or Pcbnew. */ -void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard( wxCommandEvent& aEvt ) +void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard() { wxRect DrawArea; BASE_SCREEN* screen = GetScreen(); diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h index a933652ac9..cc8c1530ed 100644 --- a/eeschema/tools/ee_actions.h +++ b/eeschema/tools/ee_actions.h @@ -152,6 +152,7 @@ public: // Suite operations static TOOL_ACTION editWithLibEdit; static TOOL_ACTION showPcbNew; + static TOOL_ACTION exportNetlist; static TOOL_ACTION generateBOM; static TOOL_ACTION runSimulation; diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index a125c02d78..001fb3f579 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -40,7 +40,7 @@ #include #include #include -#include +#include #include #include #include @@ -218,10 +218,10 @@ bool EE_SELECTION_TOOL::Init() menu.AddItem( EE_ACTIONS::drawBus, schEditCondition && EE_CONDITIONS::Empty, 100 ); menu.AddSeparator( 100 ); - menu.AddItem( EE_ACTIONS::finishWire, SCH_WIRE_BUS_TOOL::IsDrawingWire, 100 ); + menu.AddItem( EE_ACTIONS::finishWire, SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire, 100 ); menu.AddSeparator( 100 ); - menu.AddItem( EE_ACTIONS::finishBus, SCH_WIRE_BUS_TOOL::IsDrawingBus, 100 ); + menu.AddItem( EE_ACTIONS::finishBus, SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus, 100 ); menu.AddSeparator( 200 ); menu.AddItem( EE_ACTIONS::selectConnection, wireOrBusSelection && EE_CONDITIONS::Idle, 250 ); diff --git a/eeschema/tools/sch_edit_tool.cpp b/eeschema/tools/sch_edit_tool.cpp index a3ffd82644..fb4a5d626f 100644 --- a/eeschema/tools/sch_edit_tool.cpp +++ b/eeschema/tools/sch_edit_tool.cpp @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -280,7 +280,7 @@ bool SCH_EDIT_TOOL::Init() }; auto duplicateCondition = [] ( const SELECTION& aSel ) { - if( SCH_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) ) + if( SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) ) return false; return true; @@ -290,7 +290,7 @@ bool SCH_EDIT_TOOL::Init() if( aSel.Empty() ) return false; - if( SCH_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) ) + if( SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) ) return false; SCH_ITEM* item = (SCH_ITEM*) aSel.Front(); diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp index eb8f5c893e..62910a785f 100644 --- a/eeschema/tools/sch_editor_control.cpp +++ b/eeschema/tools/sch_editor_control.cpp @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -115,6 +115,11 @@ TOOL_ACTION EE_ACTIONS::showPcbNew( "eeschema.EditorControl.showPcbNew", _( "Open PCB Editor" ), _( "Run Pcbnew" ), pcbnew_xpm ); +TOOL_ACTION EE_ACTIONS::exportNetlist( "eeschema.EditorControl.exportNetlist", + AS_GLOBAL, 0, "", + _( "Export Netlist..." ), _( "Export file containing netlist in one of several formats" ), + netlist_xpm ); + TOOL_ACTION EE_ACTIONS::generateBOM( "eeschema.EditorControl.generateBOM", AS_GLOBAL, 0, "", _( "Generate BOM..." ), _( "Generate a bill of materials for the current schematic" ), @@ -1120,6 +1125,18 @@ int SCH_EDITOR_CONTROL::UpdatePCB( const TOOL_EVENT& aEvent ) } +int SCH_EDITOR_CONTROL::ExportNetlist( const TOOL_EVENT& aEvent ) +{ + int result = NET_PLUGIN_CHANGE; + + // If a plugin is removed or added, rebuild and reopen the new dialog + while( result == NET_PLUGIN_CHANGE ) + result = InvokeDialogNetList( m_frame ); + + return 0; +} + + int SCH_EDITOR_CONTROL::GenerateBOM( const TOOL_EVENT& aEvent ) { InvokeDialogCreateBOM( m_frame ); @@ -1248,6 +1265,7 @@ void SCH_EDITOR_CONTROL::setTransitions() Go( &SCH_EDITOR_CONTROL::EditSymbolLibraryLinks,EE_ACTIONS::editSymbolLibraryLinks.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ShowPcbNew, EE_ACTIONS::showPcbNew.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::UpdatePCB, ACTIONS::updatePcbFromSchematic.MakeEvent() ); + Go( &SCH_EDITOR_CONTROL::ExportNetlist, EE_ACTIONS::exportNetlist.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::GenerateBOM, EE_ACTIONS::generateBOM.MakeEvent() ); Go( &SCH_EDITOR_CONTROL::ShowBusManager, EE_ACTIONS::showBusManager.MakeEvent() ); diff --git a/eeschema/tools/sch_editor_control.h b/eeschema/tools/sch_editor_control.h index dbd75aa7fd..c3a4394cd1 100644 --- a/eeschema/tools/sch_editor_control.h +++ b/eeschema/tools/sch_editor_control.h @@ -108,6 +108,7 @@ public: int EditSymbolLibraryLinks( const TOOL_EVENT& aEvent ); int ShowPcbNew( const TOOL_EVENT& aEvent ); int UpdatePCB( const TOOL_EVENT& aEvent ); + int ExportNetlist( const TOOL_EVENT& aEvent ); int GenerateBOM( const TOOL_EVENT& aEvent ); int ShowBusManager( const TOOL_EVENT& aEvent ); diff --git a/eeschema/tools/sch_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp similarity index 95% rename from eeschema/tools/sch_wire_bus_tool.cpp rename to eeschema/tools/sch_line_wire_bus_tool.cpp index a33fbdac2d..575de0e851 100644 --- a/eeschema/tools/sch_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -22,7 +22,7 @@ */ #include -#include +#include #include #include #include @@ -182,21 +182,21 @@ private: }; -SCH_WIRE_BUS_TOOL::SCH_WIRE_BUS_TOOL() : +SCH_LINE_WIRE_BUS_TOOL::SCH_LINE_WIRE_BUS_TOOL() : EE_TOOL_BASE( "eeschema.InteractiveDrawingLineWireBus" ) { m_busUnfold = {}; } -SCH_WIRE_BUS_TOOL::~SCH_WIRE_BUS_TOOL() +SCH_LINE_WIRE_BUS_TOOL::~SCH_LINE_WIRE_BUS_TOOL() { } using E_C = EE_CONDITIONS; -bool SCH_WIRE_BUS_TOOL::Init() +bool SCH_LINE_WIRE_BUS_TOOL::Init() { EE_TOOL_BASE::Init(); @@ -265,28 +265,28 @@ static bool isNewSegment( SCH_ITEM* aItem ) } -bool SCH_WIRE_BUS_TOOL::IsDrawingLine( const SELECTION& aSelection ) +bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingLine( const SELECTION& aSelection ) { static KICAD_T graphicLineType[] = { SCH_LINE_LOCATE_GRAPHIC_LINE_T, EOT }; return IsDrawingLineWireOrBus( aSelection ) && aSelection.Front()->IsType( graphicLineType ); } -bool SCH_WIRE_BUS_TOOL::IsDrawingWire( const SELECTION& aSelection ) +bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingWire( const SELECTION& aSelection ) { static KICAD_T wireType[] = { SCH_LINE_LOCATE_WIRE_T, EOT }; return IsDrawingLineWireOrBus( aSelection ) && aSelection.Front()->IsType( wireType ); } -bool SCH_WIRE_BUS_TOOL::IsDrawingBus( const SELECTION& aSelection ) +bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingBus( const SELECTION& aSelection ) { static KICAD_T busType[] = { SCH_LINE_LOCATE_BUS_T, EOT }; return IsDrawingLineWireOrBus( aSelection ) && aSelection.Front()->IsType( busType ); } -bool SCH_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( const SELECTION& aSelection ) +bool SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( const SELECTION& aSelection ) { // NOTE: for immediate hotkeys, it is NOT required that the line, wire or bus tool // be selected @@ -295,7 +295,7 @@ bool SCH_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( const SELECTION& aSelection ) } -int SCH_WIRE_BUS_TOOL::DrawWires( const TOOL_EVENT& aEvent ) +int SCH_LINE_WIRE_BUS_TOOL::DrawWires( const TOOL_EVENT& aEvent ) { if( aEvent.HasPosition() ) // Start drawing { @@ -315,7 +315,7 @@ int SCH_WIRE_BUS_TOOL::DrawWires( const TOOL_EVENT& aEvent ) } -int SCH_WIRE_BUS_TOOL::DrawBusses( const TOOL_EVENT& aEvent ) +int SCH_LINE_WIRE_BUS_TOOL::DrawBusses( const TOOL_EVENT& aEvent ) { if( aEvent.HasPosition() ) // Start drawing { @@ -335,7 +335,7 @@ int SCH_WIRE_BUS_TOOL::DrawBusses( const TOOL_EVENT& aEvent ) } -int SCH_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent ) +int SCH_LINE_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent ) { wxString* netPtr = aEvent.Parameter(); wxString net; @@ -390,7 +390,7 @@ int SCH_WIRE_BUS_TOOL::UnfoldBus( const TOOL_EVENT& aEvent ) } -SCH_LINE* SCH_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet ) +SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet ) { wxPoint pos = (wxPoint) getViewControls()->GetCursorPosition(); @@ -413,7 +413,7 @@ SCH_LINE* SCH_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet ) } -int SCH_WIRE_BUS_TOOL::DrawLines( const TOOL_EVENT& aEvent) +int SCH_LINE_WIRE_BUS_TOOL::DrawLines( const TOOL_EVENT& aEvent) { if( aEvent.HasPosition() ) // Start drawing { @@ -525,7 +525,7 @@ static void computeBreakPoint( SCH_SCREEN* aScreen, SCH_LINE* aSegment, wxPoint& } -int SCH_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment, bool aImmediateMode ) +int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment, bool aImmediateMode ) { bool forceHV = m_frame->GetForceHVLines(); SCH_SCREEN* screen = m_frame->GetScreen(); @@ -741,7 +741,7 @@ int SCH_WIRE_BUS_TOOL::doDrawSegments( int aType, SCH_LINE* aSegment, bool aImme } -SCH_LINE* SCH_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos ) +SCH_LINE* SCH_LINE_WIRE_BUS_TOOL::startSegments( int aType, const VECTOR2D& aPos ) { SCH_LINE* segment = nullptr; bool forceHV = m_frame->GetForceHVLines(); @@ -836,7 +836,7 @@ static void removeBacktracks( DLIST& aWires ) } -void SCH_WIRE_BUS_TOOL::finishSegments() +void SCH_LINE_WIRE_BUS_TOOL::finishSegments() { // Clear selection when done so that a new wire can be started. // NOTE: this must be done before RemoveBacktracks is called or we might end up with @@ -932,11 +932,11 @@ void SCH_WIRE_BUS_TOOL::finishSegments() } -void SCH_WIRE_BUS_TOOL::setTransitions() +void SCH_LINE_WIRE_BUS_TOOL::setTransitions() { - Go( &SCH_WIRE_BUS_TOOL::DrawWires, EE_ACTIONS::drawWire.MakeEvent() ); - Go( &SCH_WIRE_BUS_TOOL::DrawBusses, EE_ACTIONS::drawBus.MakeEvent() ); - Go( &SCH_WIRE_BUS_TOOL::DrawLines, EE_ACTIONS::drawLines.MakeEvent() ); + Go( &SCH_LINE_WIRE_BUS_TOOL::DrawWires, EE_ACTIONS::drawWire.MakeEvent() ); + Go( &SCH_LINE_WIRE_BUS_TOOL::DrawBusses, EE_ACTIONS::drawBus.MakeEvent() ); + Go( &SCH_LINE_WIRE_BUS_TOOL::DrawLines, EE_ACTIONS::drawLines.MakeEvent() ); - Go( &SCH_WIRE_BUS_TOOL::UnfoldBus, EE_ACTIONS::unfoldBus.MakeEvent() ); + Go( &SCH_LINE_WIRE_BUS_TOOL::UnfoldBus, EE_ACTIONS::unfoldBus.MakeEvent() ); } diff --git a/eeschema/tools/sch_wire_bus_tool.h b/eeschema/tools/sch_line_wire_bus_tool.h similarity index 92% rename from eeschema/tools/sch_wire_bus_tool.h rename to eeschema/tools/sch_line_wire_bus_tool.h index e9fdb99137..b855027ea4 100644 --- a/eeschema/tools/sch_wire_bus_tool.h +++ b/eeschema/tools/sch_line_wire_bus_tool.h @@ -21,8 +21,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ -#ifndef SCH_LINE_DRAWING_TOOL_H -#define SCH_LINE_DRAWING_TOOL_H +#ifndef SCH_LINE_WIRE_BUS_TOOL_H +#define SCH_LINE_WIRE_BUS_TOOL_H #include #include @@ -56,11 +56,11 @@ struct BUS_UNFOLDING_T * Tool responsible for drawing/placing items (symbols, wires, busses, labels, etc.) */ -class SCH_WIRE_BUS_TOOL : public EE_TOOL_BASE +class SCH_LINE_WIRE_BUS_TOOL : public EE_TOOL_BASE { public: - SCH_WIRE_BUS_TOOL(); - ~SCH_WIRE_BUS_TOOL(); + SCH_LINE_WIRE_BUS_TOOL(); + ~SCH_LINE_WIRE_BUS_TOOL(); /// @copydoc TOOL_INTERACTIVE::Init() bool Init() override; @@ -91,4 +91,4 @@ private: BUS_UNFOLDING_T m_busUnfold; }; -#endif /* SCH_LINE_DRAWING_TOOL_H */ +#endif /* SCH_LINE_WIRE_BUS_TOOL_H */ diff --git a/eeschema/tools/sch_move_tool.cpp b/eeschema/tools/sch_move_tool.cpp index d4d9a311cb..ede1b1d1c5 100644 --- a/eeschema/tools/sch_move_tool.cpp +++ b/eeschema/tools/sch_move_tool.cpp @@ -23,7 +23,7 @@ #include #include -#include +#include #include #include #include @@ -72,7 +72,7 @@ bool SCH_MOVE_TOOL::Init() if( aSel.Empty() ) return false; - if( SCH_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) ) + if( SCH_LINE_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( aSel ) ) return false; return true; diff --git a/include/id.h b/include/id.h index 3df039d970..ea22479e8d 100644 --- a/include/id.h +++ b/include/id.h @@ -236,9 +236,6 @@ enum main_id ID_MOUSE_CLICK, ID_MOUSE_DOUBLECLICK, - ID_DRAG_POINT, - - ID_GET_NETLIST, ID_FIND_ITEMS, ID_EDA_SOCKET_EVENT_SERV,