Code clarification and commenting.

Also renames toolbar files to reduce confusion with the modern toolset
tool files.
This commit is contained in:
Jeff Young 2019-05-06 09:56:24 +01:00
parent 8e75824d29
commit a12d769074
11 changed files with 49 additions and 23 deletions

View File

@ -124,7 +124,7 @@ set ( EESCHEMA_LIBEDIT_SRCS
libedit/pinedit.cpp
libedit/symbdraw.cpp
libedit/symbedit.cpp
libedit/tool_lib.cpp
libedit/toolbars_libedit.cpp
libedit/lib_export.cpp
libedit/lib_manager.cpp
@ -221,8 +221,8 @@ set( EESCHEMA_SRCS
symbol_tree_synchronizing_adapter.cpp
template_fieldnames.cpp
template_fieldnames_keywords.cpp
tool_sch.cpp
tool_viewlib.cpp
toolbars_sch_editor.cpp
toolbars_viewlib.cpp
transform.cpp
viewlib_frame.cpp
viewlibs.cpp

View File

@ -48,7 +48,7 @@ TOOL_ACTION SCH_ACTIONS::startWire( "eeschema.WireBusDrawing.startWire",
_( "Start Wire" ), _( "Start drawing a wire" ),
add_line_xpm, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::drawWire( "eeschema.WireBusDrawing.drawWire",
TOOL_ACTION SCH_ACTIONS::drawWire( "eeschema.WireBusDrawing.drawWires",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BEGIN_WIRE ),
_( "Add Wire" ), _( "Add a wire" ),
add_line_xpm, AF_ACTIVATE );
@ -58,7 +58,7 @@ TOOL_ACTION SCH_ACTIONS::startBus( "eeschema.WireBusDrawing.startBus",
_( "Start Bus" ), _( "Start drawing a bus" ),
add_bus_xpm, AF_ACTIVATE );
TOOL_ACTION SCH_ACTIONS::drawBus( "eeschema.WireBusDrawing.drawBus",
TOOL_ACTION SCH_ACTIONS::drawBus( "eeschema.WireBusDrawing.drawBusses",
AS_GLOBAL, TOOL_ACTION::LegacyHotKey( HK_BEGIN_BUS ),
_( "Add Bus" ), _( "Add a bus" ),
add_bus_xpm, AF_ACTIVATE );
@ -322,6 +322,9 @@ bool SCH_WIRE_BUS_TOOL::IsDrawingLineWireOrBus( const SELECTION& aSelection )
}
/*
* Immediate action: start drawing a wire. Does not select the wire tool.
*/
int SCH_WIRE_BUS_TOOL::StartWire( const TOOL_EVENT& aEvent )
{
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection, true );
@ -334,7 +337,10 @@ int SCH_WIRE_BUS_TOOL::StartWire( const TOOL_EVENT& aEvent )
}
int SCH_WIRE_BUS_TOOL::DrawWire( const TOOL_EVENT& aEvent )
/*
* Tool action: first call selects the tool; subsequent calls start wires.
*/
int SCH_WIRE_BUS_TOOL::DrawWires( const TOOL_EVENT& aEvent )
{
if( m_frame->GetToolId() == ID_WIRE_BUTT )
return StartWire( aEvent );
@ -348,6 +354,9 @@ int SCH_WIRE_BUS_TOOL::DrawWire( const TOOL_EVENT& aEvent )
}
/*
* Immediate action: start drawing a bus. Does not select the bus tool.
*/
int SCH_WIRE_BUS_TOOL::StartBus( const TOOL_EVENT& aEvent )
{
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection, true );
@ -360,7 +369,10 @@ int SCH_WIRE_BUS_TOOL::StartBus( const TOOL_EVENT& aEvent )
}
int SCH_WIRE_BUS_TOOL::DrawBus( const TOOL_EVENT& aEvent )
/*
* Tool action: first call selects the tool; subsequent calls start busses.
*/
int SCH_WIRE_BUS_TOOL::DrawBusses( const TOOL_EVENT& aEvent )
{
if( m_frame->GetToolId() == ID_BUS_BUTT )
return StartBus( aEvent );
@ -455,7 +467,10 @@ SCH_LINE* SCH_WIRE_BUS_TOOL::doUnfoldBus( const wxString& aNet )
}
int SCH_WIRE_BUS_TOOL::StartLines( const TOOL_EVENT& aEvent)
/*
* Immediate action: start drawing a line. Does not select the line tool.
*/
int SCH_WIRE_BUS_TOOL::StartLine( const TOOL_EVENT& aEvent)
{
m_toolMgr->RunAction( SCH_ACTIONS::clearSelection, true );
@ -465,10 +480,13 @@ int SCH_WIRE_BUS_TOOL::StartLines( const TOOL_EVENT& aEvent)
}
/*
* Tool action: first call selects the tool; subsequent calls start lines.
*/
int SCH_WIRE_BUS_TOOL::DrawLines( const TOOL_EVENT& aEvent)
{
if( m_frame->GetToolId() == ID_LINE_COMMENT_BUTT )
return StartLines( aEvent );
return StartLine( aEvent );
else
{
m_frame->SetToolID( ID_LINE_COMMENT_BUTT, wxCURSOR_PENCIL, _( "Add lines" ) );
@ -984,13 +1002,13 @@ void SCH_WIRE_BUS_TOOL::finishSegments()
void SCH_WIRE_BUS_TOOL::setTransitions()
{
Go( &SCH_WIRE_BUS_TOOL::DrawWire, SCH_ACTIONS::drawWire.MakeEvent() );
Go( &SCH_WIRE_BUS_TOOL::DrawBus, SCH_ACTIONS::drawBus.MakeEvent() );
Go( &SCH_WIRE_BUS_TOOL::DrawWires, SCH_ACTIONS::drawWire.MakeEvent() );
Go( &SCH_WIRE_BUS_TOOL::DrawBusses, SCH_ACTIONS::drawBus.MakeEvent() );
Go( &SCH_WIRE_BUS_TOOL::DrawLines, SCH_ACTIONS::drawLines.MakeEvent() );
Go( &SCH_WIRE_BUS_TOOL::StartWire, SCH_ACTIONS::startWire.MakeEvent() );
Go( &SCH_WIRE_BUS_TOOL::StartBus, SCH_ACTIONS::startBus.MakeEvent() );
Go( &SCH_WIRE_BUS_TOOL::StartLines, SCH_ACTIONS::startLines.MakeEvent() );
Go( &SCH_WIRE_BUS_TOOL::StartLine, SCH_ACTIONS::startLines.MakeEvent() );
Go( &SCH_WIRE_BUS_TOOL::UnfoldBus, SCH_ACTIONS::unfoldBus.MakeEvent() );
}

View File

@ -72,12 +72,20 @@ public:
///> Get the SCH_LINE_DRAWING_TOOL top-level context menu
inline TOOL_MENU& GetToolMenu() { return m_menu; }
/*
* These are the immediate actions. They start drawing at the mouse location. They
* do not select the tool.
*/
int StartWire( const TOOL_EVENT& aEvent );
int StartBus( const TOOL_EVENT& aEvent );
int StartLines( const TOOL_EVENT& aEvent );
int StartLine( const TOOL_EVENT& aEvent );
int DrawWire( const TOOL_EVENT& aEvent );
int DrawBus( const TOOL_EVENT& aEvent );
/*
* These are the two-step actions. They select the tool on the first call, and start
* drawing on subsequent calls.
*/
int DrawWires( const TOOL_EVENT& aEvent );
int DrawBusses( const TOOL_EVENT& aEvent );
int DrawLines( const TOOL_EVENT& aEvent );
int UnfoldBus( const TOOL_EVENT& aEvent );

View File

@ -309,10 +309,10 @@ set( PCBNEW_CLASS_SRCS
specctra_import_export/specctra_keywords.cpp
target_edit.cpp
text_mod_grid_table.cpp
tool_footprint_editor.cpp
tool_footprint_viewer.cpp
tool_onrightclick.cpp
tool_pcb_editor.cpp
toolbars_footprint_editor.cpp
toolbars_footprint_viewer.cpp
toolbar_onrightclick.cpp
toolbars_pcb_editor.cpp
toolbars_update_user_interface.cpp
tracks_cleaner.cpp
undo_redo.cpp