Process all pending events before re-starting, fixes #31

This commit is contained in:
Alexander Kojevnikov 2012-09-20 10:16:51 -07:00
parent f073eec154
commit 08f651eada
3 changed files with 4 additions and 9 deletions

View File

@ -36,7 +36,6 @@ extern "C" {
BEGIN_EVENT_TABLE(SpekSpectrogram, wxWindow)
EVT_CHAR(SpekSpectrogram::on_char)
EVT_IDLE(SpekSpectrogram::on_idle)
EVT_PAINT(SpekSpectrogram::on_paint)
EVT_SIZE(SpekSpectrogram::on_size)
SPEK_EVT_HAVE_SAMPLE(SpekSpectrogram::on_have_sample)
@ -136,12 +135,6 @@ void SpekSpectrogram::on_char(wxKeyEvent& evt)
Refresh();
}
void SpekSpectrogram::on_idle(wxIdleEvent& evt)
{
// TODO: remove?
Update();
}
void SpekSpectrogram::on_paint(wxPaintEvent& evt)
{
wxAutoBufferedPaintDC dc(this);
@ -393,6 +386,9 @@ void SpekSpectrogram::stop()
if (this->pipeline) {
spek_pipeline_close(this->pipeline);
this->pipeline = NULL;
// Make sure all have_sample events are processed before returning.
wxApp::GetInstance()->ProcessPendingEvents();
}
}

View File

@ -35,7 +35,6 @@ public:
private:
void on_char(wxKeyEvent& evt);
void on_idle(wxIdleEvent& evt);
void on_paint(wxPaintEvent& evt);
void on_size(wxSizeEvent& evt);
void on_have_sample(SpekHaveSampleEvent& evt);

View File

@ -104,7 +104,7 @@ SpekWindow::SpekWindow(const wxString& path) :
wxMenu *menu_help = new wxMenu();
wxMenuItem *menu_help_contents = new wxMenuItem(
menu_help, wxID_HELP, _("&Help") + wxT("\tF1"));
menu_help, wxID_HELP, wxString(_("&Help")) + wxT("\tF1"));
menu_help->Append(menu_help_contents);
wxMenuItem *menu_help_about = new wxMenuItem(menu_help, wxID_ABOUT);
menu_help_about->SetItemLabel(menu_help_about->GetItemLabelText() + wxT("\tShift-F1"));