1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-15 23:59:37 +02:00

Bug 2083 - Labels Editor has confusing selection interface - can cause wrong labels to be deleted

This commit is contained in:
Leland Lucius 2021-01-26 12:18:51 -06:00
parent f59ba86faf
commit e5bb95d6f2
3 changed files with 14 additions and 0 deletions

View File

@ -130,6 +130,7 @@ void LabelDialog::PopulateLabels()
// Build the initial (empty) grid
mGrid->CreateGrid(0, Col_Max, wxGrid::wxGridSelectRows);
mGrid->SetDefaultCellAlignment(wxALIGN_LEFT, wxALIGN_CENTER);
mGrid->SetRowLabelSize(0);
size_t ii = 0;
for ( const auto &label : {

View File

@ -468,6 +468,7 @@ BEGIN_EVENT_TABLE(Grid, wxGrid)
EVT_SET_FOCUS(Grid::OnSetFocus)
EVT_KEY_DOWN(Grid::OnKeyDown)
EVT_GRID_SELECT_CELL(Grid::OnSelectCell)
EVT_GRID_EDITOR_SHOWN(Grid::OnEditorShown)
END_EVENT_TABLE()
Grid::Grid(wxWindow *parent,
@ -500,6 +501,8 @@ Grid::Grid(wxWindow *parent,
safenew wxGridCellStringRenderer,
safenew ChoiceEditor);
// Bug #2803:
// Ensure selection doesn't show up.
SetSelectionForeground(GetDefaultCellTextColour());
SetSelectionBackground(GetDefaultCellBackgroundColour());
}
@ -534,6 +537,15 @@ void Grid::OnSelectCell(wxGridEvent &event)
#endif
}
void Grid::OnEditorShown(wxGridEvent &event)
{
event.Skip();
// Bug #2803 (comment 7):
// Select row whenever an editor is displayed
SelectRow(GetGridCursorRow());
}
void Grid::OnKeyDown(wxKeyEvent &event)
{
auto keyCode = event.GetKeyCode();

View File

@ -210,6 +210,7 @@ class Grid final : public wxGrid
void OnSetFocus(wxFocusEvent &event);
void OnSelectCell(wxGridEvent &event);
void OnEditorShown(wxGridEvent &event);
void OnKeyDown(wxKeyEvent &event);
private: