Page layout editor: fix incorrect management of block operation in context (popup) menu.

This commit is contained in:
jean-pierre charras 2018-03-11 18:38:27 +01:00
parent f1cf95b8dd
commit 17f6d09935
3 changed files with 26 additions and 2 deletions

View File

@ -907,9 +907,13 @@ void SCH_EDIT_FRAME::doUpdatePcb( const wxString& aUpdateOptions )
exporter.Format( &formatter, GNL_ALL );
// Copy the netlist in a static string, to have a long life time
// and giving to Pcbnew the time to analyze this netlist:
static std::string netlist_string;
netlist_string = wxString::Format("%s\n%s", aUpdateOptions, formatter.GetString() ).ToStdString();
// Now, send the "kicad" (s-expr) netlist to Pcbnew
Kiway().ExpressMail( FRAME_PCB, MAIL_SCH_PCB_UPDATE,
wxString::Format("%s\n%s", aUpdateOptions, formatter.GetString() ).ToStdString(), this );
Kiway().ExpressMail( FRAME_PCB, MAIL_SCH_PCB_UPDATE, netlist_string, this );
}

View File

@ -99,6 +99,7 @@ BEGIN_EVENT_TABLE( PL_EDITOR_FRAME, EDA_DRAW_FRAME )
// the ID_NO_TOOL_SELECTED id TOOL does not existing currently, but the right click
// popup menu can generate this event.
EVT_TOOL( ID_NO_TOOL_SELECTED, PL_EDITOR_FRAME::Process_Special_Functions )
EVT_TOOL( ID_POPUP_CANCEL_CURRENT_COMMAND, PL_EDITOR_FRAME::Process_Special_Functions )
EVT_MENU_RANGE( ID_POPUP_START_RANGE, ID_POPUP_END_RANGE,
PL_EDITOR_FRAME::Process_Special_Functions )
@ -155,6 +156,15 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_CANCEL_CURRENT_COMMAND:
if( m_canvas->IsMouseCaptured() )
{
m_canvas->EndMouseCapture();
SetToolID( GetToolId(), m_canvas->GetCurrentCursor(), wxEmptyString );
}
else
{
SetNoToolSelected();
}
break;
case ID_POPUP_DESIGN_TREE_ITEM_DELETE:

View File

@ -61,8 +61,18 @@ void AddNewItemsCommand( wxMenu* aMainMenu )
bool PL_EDITOR_FRAME::OnRightClick( const wxPoint& aPosition, wxMenu* aPopMenu )
{
bool busy = GetScreen()->GetCurItem() != NULL;
bool blockActive = GetScreen()->IsBlockActive();
wxString msg;
if( blockActive )
{
AddMenuItem( aPopMenu, ID_POPUP_CANCEL_CURRENT_COMMAND, _( "Cancel Block" ),
KiBitmap( cancel_xpm ) );
aPopMenu->AppendSeparator();
return true;
}
// If the tool ID_ZOOM_SELECTION is currently in use, add a
if( GetToolId() == ID_ZOOM_SELECTION && !busy )
{