Use more reflective naming of what the tool does.

This commit is contained in:
Jeff Young 2019-06-16 14:42:40 +01:00
parent 66d2060942
commit c7bfa9857e
14 changed files with 62 additions and 63 deletions

View File

@ -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
)

View File

@ -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 );

View File

@ -64,7 +64,7 @@
#include <tools/ee_picker_tool.h>
#include <tools/ee_point_editor.h>
#include <tools/sch_drawing_tools.h>
#include <tools/sch_wire_bus_tool.h>
#include <tools/sch_line_wire_bus_tool.h>
#include <tools/sch_move_tool.h>
#include <tools/sch_edit_tool.h>
#include <tools/ee_inspection_tool.h>
@ -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()

View File

@ -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 );

View File

@ -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();

View File

@ -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;

View File

@ -40,7 +40,7 @@
#include <preview_items/selection_area.h>
#include <tool/tool_event.h>
#include <tool/tool_manager.h>
#include <tools/sch_wire_bus_tool.h>
#include <tools/sch_line_wire_bus_tool.h>
#include <ee_collectors.h>
#include <painter.h>
#include <eeschema_id.h>
@ -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 );

View File

@ -24,7 +24,7 @@
#include <tool/tool_manager.h>
#include <tools/sch_edit_tool.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_wire_bus_tool.h>
#include <tools/sch_line_wire_bus_tool.h>
#include <tools/ee_picker_tool.h>
#include <tools/sch_move_tool.h>
#include <ee_actions.h>
@ -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();

View File

@ -37,7 +37,7 @@
#include <tools/ee_selection.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_drawing_tools.h>
#include <tools/sch_wire_bus_tool.h>
#include <tools/sch_line_wire_bus_tool.h>
#include <advanced_config.h>
#include <simulation_cursors.h>
#include <sim/sim_plot_frame.h>
@ -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() );

View File

@ -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 );

View File

@ -22,7 +22,7 @@
*/
#include <connection_graph.h>
#include <sch_wire_bus_tool.h>
#include <sch_line_wire_bus_tool.h>
#include <ee_selection_tool.h>
#include <ee_actions.h>
#include <sch_edit_frame.h>
@ -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<SCH_EDIT_FRAME>( "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*>();
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<SCH_LINE>& 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() );
}

View File

@ -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 <tools/ee_tool_base.h>
#include <core/optional.h>
@ -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<SCH_EDIT_FRAME>
class SCH_LINE_WIRE_BUS_TOOL : public EE_TOOL_BASE<SCH_EDIT_FRAME>
{
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 */

View File

@ -23,7 +23,7 @@
#include <tool/tool_manager.h>
#include <tools/ee_selection_tool.h>
#include <tools/sch_wire_bus_tool.h>
#include <tools/sch_line_wire_bus_tool.h>
#include <ee_actions.h>
#include <bitmaps.h>
#include <base_struct.h>
@ -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;

View File

@ -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,