Don't show normal cut/copy/paste items in Signals grid.

(Do allow a copy of signal names though.)

Fixes https://gitlab.com/kicad/code/kicad/-/issues/17395
This commit is contained in:
Jeff Young 2024-03-11 18:14:16 +00:00
parent 5ccd11d426
commit ed61c5593f
1 changed files with 22 additions and 4 deletions

View File

@ -50,6 +50,7 @@
#include <dialogs/dialog_sim_format_value.h>
#include <eeschema_settings.h>
#include "kiplatform/app.h"
#include "wx/clipbrd.h"
SIM_TRACE_TYPE operator|( SIM_TRACE_TYPE aFirst, SIM_TRACE_TYPE aSecond )
@ -168,11 +169,12 @@ void SIGNALS_GRID_TRICKS::showPopupMenu( wxMenu& menu, wxGridEvent& aEvent )
}
menu.AppendSeparator();
menu.Append( GRIDTRICKS_ID_COPY, _( "Copy Signal Name" ) + "\tCtrl+C" );
m_grid->PopupMenu( &menu );
}
}
}
GRID_TRICKS::showPopupMenu( menu, aEvent );
}
@ -283,9 +285,25 @@ void SIGNALS_GRID_TRICKS::doPopupSelection( wxCommandEvent& event )
for( const wxString& signal : signals )
m_parent->DoFourier( signal, fundamental );
}
else
else if( event.GetId() == GRIDTRICKS_ID_COPY )
{
GRID_TRICKS::doPopupSelection( event );
wxLogNull doNotLog; // disable logging of failed clipboard actions
wxString txt;
for( const wxString& signal : signals )
{
if( !txt.IsEmpty() )
txt += '\r';
txt += signal;
}
if( wxTheClipboard->Open() )
{
wxTheClipboard->SetData( new wxTextDataObject( txt ) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
}
}
}