Implement ctrl-A/ctrl-C on our side rather than relying on wxWidgets.

Hopefully this will make it work on MSWindows as well.  (It worked on
Mac before, but evidently not MSW.  Don't know about GTK.)

Fixes https://gitlab.com/kicad/code/kicad/issues/7771
This commit is contained in:
Jeff Young 2021-03-02 11:54:13 +00:00
parent 366189b864
commit cea779ec0f
1 changed files with 20 additions and 2 deletions

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2014-2021 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -22,9 +22,10 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/clipbrd.h>
#include <kicad_string.h>
#include <dialogs/html_messagebox.h>
#include <kicad_string.h>
HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* aParent, const wxString& aTitle,
const wxPoint& aPosition, const wxSize& aSize ) :
@ -137,6 +138,23 @@ void HTML_MESSAGE_BOX::OnCharHook( wxKeyEvent& aEvent )
wxPostEvent( this, wxCommandEvent( wxEVT_COMMAND_BUTTON_CLICKED, wxID_OK ) );
return;
}
else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'A' )
{
m_htmlWindow->SelectAll();
return;
}
else if( aEvent.GetModifiers() == wxMOD_CONTROL && aEvent.GetKeyCode() == 'C' )
{
wxLogNull doNotLog; // disable logging of failed clipboard actions
if( wxTheClipboard->Open() )
{
wxTheClipboard->SetData( new wxTextDataObject( m_htmlWindow->SelectionToText() ) );
wxTheClipboard->Close();
}
return;
}
aEvent.Skip();
}