1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-22 07:28:03 +02:00

In Grid fix accessibility names of cells to handle frequencies.

In commit 9c687f0, TimeEditors etc were generalized to handle both times and frequencies.

This fixes the accessibility names of cells to handle frequencies.
This commit is contained in:
David Bailes 2016-06-28 15:02:40 +01:00
parent 12d22cafc6
commit 176a977617

View File

@ -769,30 +769,30 @@ wxAccStatus GridAx::GetName(int childId, wxString *name)
}
// Hack to provide a more intelligible response
TimeEditor *d =
(TimeEditor *)mGrid->GetDefaultEditorForType(GRID_VALUE_TIME);
TimeEditor *c =
(TimeEditor *)mGrid->GetCellEditor(row, col);
NumericEditor *dt =
static_cast<NumericEditor *>(mGrid->GetDefaultEditorForType(GRID_VALUE_TIME));
NumericEditor *df =
static_cast<NumericEditor *>(mGrid->GetDefaultEditorForType(GRID_VALUE_FREQUENCY));
NumericEditor *c =
static_cast<NumericEditor *>(mGrid->GetCellEditor(row, col));
if (c && d && c == d) {
if (c && dt && df && ( c == dt || c == df)) {
double value;
v.ToDouble(&value);
NumericConverter converter(c == dt ? NumericConverter::TIME : NumericConverter::FREQUENCY,
c->GetFormat(),
value,
c->GetRate() );
NumericTextCtrl tt(NumericConverter::TIME, mGrid,
wxID_ANY,
c->GetFormat(),
value,
c->GetRate(),
wxPoint(10000, 10000), // create offscreen
wxDefaultSize,
true);
v = tt.GetString();
v = converter.GetString();
}
if (c)
c->DecRef();
if (d)
d->DecRef();
if (dt)
dt->DecRef();
if (df)
df->DecRef();
*name = n + wxT(" ") + v;
}