mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-29 15:19:44 +02:00
Bug 2642 - Metadata Editor: Cut and paste does not work
This commit is contained in:
parent
4e6d11fe0c
commit
4b07fbaa8a
@ -1412,6 +1412,12 @@ void TagsEditorDialog::OnOk(wxCommandEvent & WXUNUSED(event))
|
||||
if (mGrid->IsCellEditControlShown()) {
|
||||
mGrid->SaveEditControlValue();
|
||||
mGrid->HideCellEditControl();
|
||||
#if defined(__WXMAC__)
|
||||
// The cell editors do not capture the ENTER key, so it invokes
|
||||
// the default button ("Ok") when it should just close the
|
||||
// editor. So, cancel the "Ok" action.
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!Validate() || !TransferDataFromWindow()) {
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/clipbrd.h>
|
||||
#include <wx/dc.h>
|
||||
#include <wx/grid.h>
|
||||
#include <wx/intl.h>
|
||||
@ -532,7 +533,50 @@ void Grid::OnSelectCell(wxGridEvent &event)
|
||||
|
||||
void Grid::OnKeyDown(wxKeyEvent &event)
|
||||
{
|
||||
switch (event.GetKeyCode())
|
||||
auto keyCode = event.GetKeyCode();
|
||||
int crow = GetGridCursorRow();
|
||||
int ccol = GetGridCursorCol();
|
||||
|
||||
if (event.CmdDown() && crow != wxGridNoCellCoords.GetRow() && ccol != wxGridNoCellCoords.GetCol())
|
||||
{
|
||||
wxClipboardLocker cb;
|
||||
|
||||
switch (keyCode)
|
||||
{
|
||||
case 'C': // Copy
|
||||
{
|
||||
wxTextDataObject *data = safenew wxTextDataObject(GetCellValue(crow, ccol));
|
||||
wxClipboard::Get()->SetData(data);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'X': // Cut
|
||||
{
|
||||
wxTextDataObject *data = safenew wxTextDataObject(GetCellValue(crow, ccol));
|
||||
wxClipboard::Get()->SetData(data);
|
||||
SetCellValue(crow, ccol, {});
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'V': // Paste
|
||||
{
|
||||
if (wxClipboard::Get()->IsSupported(wxDF_UNICODETEXT))
|
||||
{
|
||||
wxTextDataObject data;
|
||||
if (wxClipboard::Get()->GetData(data))
|
||||
{
|
||||
SetCellValue(crow, ccol, data.GetText());
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (keyCode)
|
||||
{
|
||||
case WXK_LEFT:
|
||||
case WXK_RIGHT:
|
||||
|
Loading…
x
Reference in New Issue
Block a user