mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 08:09:32 +02:00
Fix for bug 1148
This commit is contained in:
parent
439fdc66ff
commit
1878a0ddd0
@ -29,6 +29,7 @@ undo memory so as to free up space.
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/textctrl.h>
|
||||
|
||||
#include "AudioIO.h"
|
||||
#include "../images/Arrow.xpm"
|
||||
#include "../images/Empty9x16.xpm"
|
||||
#include "HistoryWindow.h"
|
||||
@ -60,6 +61,7 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
|
||||
mManager = manager;
|
||||
mProject = parent;
|
||||
mSelected = 0;
|
||||
mAudioIOBusy = false;
|
||||
|
||||
wxImageList *imageList = new wxImageList(9, 16);
|
||||
imageList->Add(wxIcon(empty9x16_xpm));
|
||||
@ -129,13 +131,45 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
|
||||
SetMinSize(GetSize());
|
||||
mList->SetColumnWidth(0, mList->GetClientSize().x - mList->GetColumnWidth(1));
|
||||
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()
|
||||
{
|
||||
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));
|
||||
}
|
||||
|
||||
void HistoryWindow::OnAudioIO(wxCommandEvent& evt)
|
||||
{
|
||||
evt.Skip();
|
||||
|
||||
if (evt.GetInt() != 0)
|
||||
mAudioIOBusy = true;
|
||||
else
|
||||
mAudioIOBusy = false;
|
||||
|
||||
mDiscard->Enable(!mAudioIOBusy);
|
||||
}
|
||||
|
||||
void HistoryWindow::UpdateDisplay()
|
||||
{
|
||||
if(IsShown())
|
||||
@ -214,6 +248,13 @@ void HistoryWindow::OnDiscard(wxCommandEvent & WXUNUSED(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 i;
|
||||
|
||||
|
@ -32,6 +32,7 @@ class HistoryWindow :public wxDialog {
|
||||
void UpdateDisplay();
|
||||
|
||||
private:
|
||||
void OnAudioIO(wxCommandEvent & evt);
|
||||
void DoUpdate();
|
||||
void UpdateLevels();
|
||||
|
||||
@ -48,7 +49,9 @@ class HistoryWindow :public wxDialog {
|
||||
wxTextCtrl *mAvail;
|
||||
wxSpinCtrl *mLevels;
|
||||
wxButton *mDiscard;
|
||||
|
||||
int mSelected;
|
||||
bool mAudioIOBusy;
|
||||
|
||||
public:
|
||||
DECLARE_EVENT_TABLE()
|
||||
|
Loading…
x
Reference in New Issue
Block a user