Ensure clipboard data is available after KiCad closes

Always Flush() after SetData()
This commit is contained in:
Roberto Fernandez Bautista 2021-05-01 23:00:08 +01:00
parent 5822cd85c4
commit ae009e0758
9 changed files with 10 additions and 0 deletions

View File

@ -696,6 +696,7 @@ void BM2CMP_FRAME::OnExportToClipboard( wxCommandEvent& event )
// This data objects are held by the clipboard,
// so do not delete them in the app.
wxTheClipboard->SetData( new wxTextDataObject( buffer.c_str() ) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
}
else

View File

@ -150,6 +150,7 @@ void HTML_MESSAGE_BOX::OnCharHook( wxKeyEvent& aEvent )
if( wxTheClipboard->Open() )
{
wxTheClipboard->SetData( new wxTextDataObject( m_htmlWindow->SelectionToText() ) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
}

View File

@ -236,6 +236,7 @@ void WX_HTML_REPORT_PANEL::onMenuEvent( wxMenuEvent& event )
bool primarySelection = wxTheClipboard->IsUsingPrimarySelection();
wxTheClipboard->UsePrimarySelection( false ); // required to use the main clipboard
wxTheClipboard->SetData( new wxTextDataObject( m_htmlView->SelectionToText() ) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
wxTheClipboard->UsePrimarySelection( primarySelection );
}

View File

@ -636,6 +636,7 @@ void GRID_TRICKS::cutcopy( bool doCopy, bool doDelete )
if( doCopy )
{
wxTheClipboard->SetData( new wxTextDataObject( txt ) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
}

View File

@ -980,6 +980,8 @@ bool TOOL_MANAGER::SaveClipboard( const std::string& aTextUTF8 )
// Store the UTF8 string as unicode string in clipboard:
wxTheClipboard->SetData( new wxTextDataObject( wxString( aTextUTF8.c_str(),
wxConvUTF8 ) ) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
return true;

View File

@ -332,6 +332,7 @@ void DIALOG_CHOOSE_SYMBOL::OnCharHook( wxKeyEvent& e )
if( wxTheClipboard->Open() )
{
wxTheClipboard->SetData( new wxTextDataObject( txt ) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
}
}

View File

@ -541,6 +541,7 @@ void SCH_EDIT_FRAME::DrawCurrentSheetToClipboard()
// This data objects are held by the clipboard, so do not delete them in the app.
wxBitmapDataObject* clipbrd_data = new wxBitmapDataObject( image );
wxTheClipboard->SetData( clipbrd_data );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
}
}

View File

@ -299,6 +299,7 @@ void PANEL_SETUP_BOARD_STACKUP::onExportToClipboard( wxCommandEvent& event )
// This data objects are held by the clipboard,
// so do not delete them in the app.
wxTheClipboard->SetData( new wxTextDataObject( report ) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
}
}

View File

@ -510,6 +510,7 @@ void PNS_LOG_VIEWER_FRAME::onListCopy( wxCommandEvent& event )
// This data objects are held by the clipboard,
// so do not delete them in the app.
wxTheClipboard->SetData( new wxTextDataObject(s) );
wxTheClipboard->Flush(); // Allow data to be available after closing KiCad
wxTheClipboard->Close();
}
}