From 176a9776174a3b132cee47ec5e1e0f7c7eacd95e Mon Sep 17 00:00:00 2001 From: David Bailes Date: Tue, 28 Jun 2016 15:02:40 +0100 Subject: [PATCH] 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. --- src/widgets/Grid.cpp | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/widgets/Grid.cpp b/src/widgets/Grid.cpp index e55e2c508..946260969 100644 --- a/src/widgets/Grid.cpp +++ b/src/widgets/Grid.cpp @@ -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(mGrid->GetDefaultEditorForType(GRID_VALUE_TIME)); + NumericEditor *df = + static_cast(mGrid->GetDefaultEditorForType(GRID_VALUE_FREQUENCY)); + NumericEditor *c = + static_cast(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; }