Tidy up and fix end sheet command.

This commit is contained in:
Jeff Young 2019-04-19 01:00:54 +01:00
parent f274e0f68b
commit d88126e519
3 changed files with 16 additions and 54 deletions

View File

@ -287,10 +287,8 @@ BEGIN_EVENT_TABLE( SCH_EDIT_FRAME, EDA_DRAW_FRAME )
// Tools and buttons for vertical toolbar. // Tools and buttons for vertical toolbar.
EVT_TOOL( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnSelectTool ) EVT_TOOL( ID_NO_TOOL_SELECTED, SCH_EDIT_FRAME::OnSelectTool )
EVT_TOOL_RANGE( ID_SCHEMATIC_VERTICAL_TOOLBAR_START, ID_SCHEMATIC_VERTICAL_TOOLBAR_END, EVT_TOOL( ID_SCHEMATIC_DELETE_ITEM_BUTT, SCH_EDIT_FRAME::OnSelectTool )
SCH_EDIT_FRAME::OnSelectTool ) EVT_TOOL( ID_MENU_DELETE_ITEM_BUTT, SCH_EDIT_FRAME::OnSelectTool )
EVT_TOOL_RANGE( ID_SCHEMATIC_PLACE_MENU_START, ID_SCHEMATIC_PLACE_MENU_END,
SCH_EDIT_FRAME::OnSelectTool )
#ifdef KICAD_SPICE #ifdef KICAD_SPICE
EVT_TOOL( ID_SIM_SHOW, SCH_EDIT_FRAME::OnSimulate ) EVT_TOOL( ID_SIM_SHOW, SCH_EDIT_FRAME::OnSimulate )

View File

@ -161,6 +161,7 @@
break; break;
case ID_POPUP_END_LINE: case ID_POPUP_END_LINE:
case ID_POPUP_SCH_END_SHEET:
m_toolManager->RunAction( SCH_ACTIONS::finishDrawing, true ); m_toolManager->RunAction( SCH_ACTIONS::finishDrawing, true );
break; break;
@ -200,11 +201,6 @@
OnModify(); OnModify();
break; break;
case ID_POPUP_SCH_END_SHEET:
m_canvas->MoveCursorToCrossHair();
AddItemToScreen( item );
break;
case ID_POPUP_SCH_CLEANUP_SHEET: case ID_POPUP_SCH_CLEANUP_SHEET:
if( item != NULL && item->Type() == SCH_SHEET_T ) if( item != NULL && item->Type() == SCH_SHEET_T )
{ {
@ -466,51 +462,8 @@ void SCH_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
// Stop the current command and deselect the current tool. // Stop the current command and deselect the current tool.
m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, GetGalCanvas()->GetDefaultCursor() ); m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, GetGalCanvas()->GetDefaultCursor() );
switch( id ) // Same for modern toolset.
{
case ID_HIGHLIGHT_BUTT:
case ID_MENU_NOCONN_BUTT:
case ID_NOCONN_BUTT:
case ID_MENU_JUNCTION_BUTT:
case ID_JUNCTION_BUTT:
case ID_MENU_LABEL_BUTT:
case ID_LABEL_BUTT:
case ID_MENU_GLABEL_BUTT:
case ID_GLOBALLABEL_BUTT:
case ID_MENU_HIERLABEL_BUTT:
case ID_HIERLABEL_BUTT:
case ID_MENU_TEXT_COMMENT_BUTT:
case ID_TEXT_COMMENT_BUTT:
case ID_MENU_ADD_IMAGE_BUTT:
case ID_ADD_IMAGE_BUTT:
case ID_MENU_WIRETOBUS_ENTRY_BUTT:
case ID_WIRETOBUS_ENTRY_BUTT:
case ID_MENU_BUSTOBUS_ENTRY_BUTT:
case ID_BUSTOBUS_ENTRY_BUTT:
case ID_MENU_PLACE_COMPONENT:
case ID_SCH_PLACE_COMPONENT:
case ID_MENU_PLACE_POWER_BUTT:
case ID_PLACE_POWER_BUTT:
case ID_MENU_WIRE_BUTT:
case ID_WIRE_BUTT:
case ID_MENU_BUS_BUTT:
case ID_BUS_BUTT:
case ID_MENU_LINE_COMMENT_BUTT:
case ID_LINE_COMMENT_BUTT:
case ID_ZOOM_SELECTION:
case ID_MENU_SHEET_SYMBOL_BUTT:
case ID_SHEET_SYMBOL_BUTT:
case ID_MENU_SHEET_PIN_BUTT:
case ID_SHEET_PIN_BUTT:
case ID_MENU_IMPORT_HLABEL_BUTT:
case ID_IMPORT_HLABEL_BUTT:
// moved to modern toolset
return;
default:
// since legacy tools don't activate themsleves, we have to deactivate any modern
// tools that might be running until all the legacy tools are moved over....
m_toolManager->DeactivateTool(); m_toolManager->DeactivateTool();
}
switch( id ) switch( id )
{ {

View File

@ -1275,6 +1275,17 @@ int SCH_DRAWING_TOOL::doDrawSheet( SCH_SHEET *aSheet )
m_frame->GetScreen()->SetCurItem( nullptr ); m_frame->GetScreen()->SetCurItem( nullptr );
} }
} }
else if( evt->IsAction( &SCH_ACTIONS::finishDrawing ) )
{
if( aSheet )
{
m_frame->AddItemToScreen( aSheet );
aSheet = nullptr;
m_view->ClearPreview();
m_frame->GetScreen()->SetCurItem( nullptr );
}
}
else if( evt->IsMotion() ) else if( evt->IsMotion() )
{ {
m_view->ClearPreview(); m_view->ClearPreview();