mirror of
https://github.com/cookiengineer/audacity
synced 2026-04-04 13:27:39 +02:00
Preliminary changes for wxWidgets 3.0.1
We can't go to 3.0.1 yet as there are still build issues on Linux and OSX. You can get Windows to build, but there's still some display issues. These changes should work with wxWidgets 2.8.12 as well, so we can take our time to get things working properly before switching over.
This commit is contained in:
@@ -79,6 +79,28 @@ void TimeEditor::BeginEdit(int row, int col, wxGrid *grid)
|
||||
GetTimeCtrl()->SetFocus();
|
||||
}
|
||||
|
||||
#if wxCHECK_VERSION(3,0,0)
|
||||
|
||||
bool TimeEditor::EndEdit(int WXUNUSED(row), int WXUNUSED(col), const wxGrid *WXUNUSED(grid), const wxString & WXUNUSED(oldval), wxString *newval)
|
||||
{
|
||||
double newtime = GetTimeCtrl()->GetTimeValue();
|
||||
bool changed = newtime != mOld;
|
||||
|
||||
if (changed) {
|
||||
mNew = newtime;
|
||||
*newval = wxString::Format(wxT("%g"), newtime);
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
|
||||
void TimeEditor::ApplyEdit(int row, int col, wxGrid *grid)
|
||||
{
|
||||
grid->GetTable()->SetValue(row, col, wxString::Format(wxT("%g"), mNew));
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
bool TimeEditor::EndEdit(int row, int col, wxGrid *grid)
|
||||
{
|
||||
double newtime = GetTimeCtrl()->GetTimeValue();
|
||||
@@ -91,6 +113,8 @@ bool TimeEditor::EndEdit(int row, int col, wxGrid *grid)
|
||||
return changed;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void TimeEditor::Reset()
|
||||
{
|
||||
GetTimeCtrl()->SetTimeValue(mOld);
|
||||
@@ -295,8 +319,40 @@ void ChoiceEditor::BeginEdit(int row, int col, wxGrid* grid)
|
||||
Choice()->SetFocus();
|
||||
}
|
||||
|
||||
#if wxCHECK_VERSION(3,0,0)
|
||||
|
||||
bool ChoiceEditor::EndEdit(int WXUNUSED(row), int WXUNUSED(col), const wxGrid* WXUNUSED(grid), const wxString & WXUNUSED(oldval), wxString *newval)
|
||||
{
|
||||
int sel = Choice()->GetSelection();
|
||||
|
||||
// This can happen if the wxChoice control is displayed and the list of choices get changed
|
||||
if ((sel < 0) || (sel >= (int)(mChoices.GetCount())))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
wxString val = mChoices[sel];
|
||||
if (val == mOld)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
*newval = val;
|
||||
|
||||
mNew = val;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void ChoiceEditor::ApplyEdit(int row, int col, wxGrid *grid)
|
||||
{
|
||||
grid->GetTable()->SetValue(row, col, mNew);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
bool ChoiceEditor::EndEdit(int row, int col,
|
||||
wxGrid* grid)
|
||||
wxGrid* grid)
|
||||
{
|
||||
int sel = Choice()->GetSelection();
|
||||
|
||||
@@ -315,6 +371,8 @@ bool ChoiceEditor::EndEdit(int row, int col,
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void ChoiceEditor::Reset()
|
||||
{
|
||||
Choice()->SetSelection(mChoices.Index(mOld));
|
||||
@@ -491,7 +549,7 @@ void Grid::OnKeyDown(wxKeyEvent &event)
|
||||
if (def && def->IsEnabled()) {
|
||||
wxCommandEvent cevent(wxEVT_COMMAND_BUTTON_CLICKED,
|
||||
def->GetId());
|
||||
GetParent()->ProcessEvent(cevent);
|
||||
GetParent()->GetEventHandler()->ProcessEvent(cevent);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user