1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-17 00:20:06 +02:00

Fix for bug 1148

This commit is contained in:
Steve Daulton 2015-08-24 00:36:40 +01:00
parent 439fdc66ff
commit 1878a0ddd0
2 changed files with 44 additions and 0 deletions

View File

@ -29,6 +29,7 @@ undo memory so as to free up space.
#include <wx/stattext.h> #include <wx/stattext.h>
#include <wx/textctrl.h> #include <wx/textctrl.h>
#include "AudioIO.h"
#include "../images/Arrow.xpm" #include "../images/Arrow.xpm"
#include "../images/Empty9x16.xpm" #include "../images/Empty9x16.xpm"
#include "HistoryWindow.h" #include "HistoryWindow.h"
@ -60,6 +61,7 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
mManager = manager; mManager = manager;
mProject = parent; mProject = parent;
mSelected = 0; mSelected = 0;
mAudioIOBusy = false;
wxImageList *imageList = new wxImageList(9, 16); wxImageList *imageList = new wxImageList(9, 16);
imageList->Add(wxIcon(empty9x16_xpm)); imageList->Add(wxIcon(empty9x16_xpm));
@ -129,13 +131,45 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
SetMinSize(GetSize()); SetMinSize(GetSize());
mList->SetColumnWidth(0, mList->GetClientSize().x - mList->GetColumnWidth(1)); mList->SetColumnWidth(0, mList->GetClientSize().x - mList->GetColumnWidth(1));
mList->SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT)); mList->SetTextColour(wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOWTEXT));
wxTheApp->Connect(EVT_AUDIOIO_PLAYBACK,
wxCommandEventHandler(HistoryWindow::OnAudioIO),
NULL,
this);
wxTheApp->Connect(EVT_AUDIOIO_CAPTURE,
wxCommandEventHandler(HistoryWindow::OnAudioIO),
NULL,
this);
} }
HistoryWindow::~HistoryWindow() HistoryWindow::~HistoryWindow()
{ {
wxTheApp->Disconnect(EVT_AUDIOIO_PLAYBACK,
wxCommandEventHandler(HistoryWindow::OnAudioIO),
NULL,
this);
wxTheApp->Disconnect(EVT_AUDIOIO_CAPTURE,
wxCommandEventHandler(HistoryWindow::OnAudioIO),
NULL,
this);
mAvail->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(HistoryWindow::OnChar)); mAvail->Disconnect(wxEVT_KEY_DOWN, wxKeyEventHandler(HistoryWindow::OnChar));
} }
void HistoryWindow::OnAudioIO(wxCommandEvent& evt)
{
evt.Skip();
if (evt.GetInt() != 0)
mAudioIOBusy = true;
else
mAudioIOBusy = false;
mDiscard->Enable(!mAudioIOBusy);
}
void HistoryWindow::UpdateDisplay() void HistoryWindow::UpdateDisplay()
{ {
if(IsShown()) if(IsShown())
@ -214,6 +248,13 @@ void HistoryWindow::OnDiscard(wxCommandEvent & WXUNUSED(event))
void HistoryWindow::OnItemSelected(wxListEvent &event) void HistoryWindow::OnItemSelected(wxListEvent &event)
{ {
if (mAudioIOBusy) {
mList->SetItemState(mSelected,
wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED,
wxLIST_STATE_FOCUSED | wxLIST_STATE_SELECTED);
return;
}
int selected = event.GetIndex(); int selected = event.GetIndex();
int i; int i;

View File

@ -32,6 +32,7 @@ class HistoryWindow :public wxDialog {
void UpdateDisplay(); void UpdateDisplay();
private: private:
void OnAudioIO(wxCommandEvent & evt);
void DoUpdate(); void DoUpdate();
void UpdateLevels(); void UpdateLevels();
@ -48,7 +49,9 @@ class HistoryWindow :public wxDialog {
wxTextCtrl *mAvail; wxTextCtrl *mAvail;
wxSpinCtrl *mLevels; wxSpinCtrl *mLevels;
wxButton *mDiscard; wxButton *mDiscard;
int mSelected; int mSelected;
bool mAudioIOBusy;
public: public:
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()