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

History window listens for events

This commit is contained in:
Paul Licameli 2018-02-17 15:31:18 -05:00
parent dbcf8ae59b
commit ad8fafa6a0
5 changed files with 9 additions and 28 deletions

View File

@ -31,6 +31,7 @@ undo memory so as to free up space.
#include <wx/textctrl.h>
#include "AudioIO.h"
#include "AudacityApp.h"
#include "../images/Arrow.xpm"
#include "../images/Empty9x16.xpm"
#include "HistoryWindow.h"
@ -154,6 +155,11 @@ HistoryWindow::HistoryWindow(AudacityProject *parent, UndoManager *manager):
wxTheApp->Bind(EVT_AUDIOIO_CAPTURE,
&HistoryWindow::OnAudioIO,
this);
wxTheApp->Bind(EVT_CLIPBOARD_CHANGE, &HistoryWindow::UpdateDisplay, this);
manager->Bind(EVT_UNDO_PUSHED, &HistoryWindow::UpdateDisplay, this);
manager->Bind(EVT_UNDO_MODIFIED, &HistoryWindow::UpdateDisplay, this);
manager->Bind(EVT_UNDO_RESET, &HistoryWindow::UpdateDisplay, this);
}
void HistoryWindow::OnAudioIO(wxCommandEvent& evt)
@ -168,8 +174,9 @@ void HistoryWindow::OnAudioIO(wxCommandEvent& evt)
mDiscard->Enable(!mAudioIOBusy);
}
void HistoryWindow::UpdateDisplay()
void HistoryWindow::UpdateDisplay(wxEvent& e)
{
e.Skip();
if(IsShown())
DoUpdate();
}

View File

@ -29,7 +29,7 @@ class HistoryWindow final : public wxDialogWrapper {
public:
HistoryWindow(AudacityProject * parent, UndoManager *manager);
void UpdateDisplay();
void UpdateDisplay(wxEvent &e);
private:
void OnAudioIO(wxCommandEvent & evt);

View File

@ -4591,9 +4591,6 @@ void AudacityProject::InitialState()
GetUndoManager()->StateSaved();
if (mHistoryWindow)
mHistoryWindow->UpdateDisplay();
GetMenuManager(*this).ModifyUndoMenuItems(*this);
GetMenuManager(*this).UpdateMenus(*this);
@ -4629,9 +4626,6 @@ void AudacityProject::PushState(const wxString &desc,
mDirty = true;
if (mHistoryWindow)
mHistoryWindow->UpdateDisplay();
GetMenuManager(*this).ModifyUndoMenuItems(*this);
GetMenuManager(*this).UpdateMenus(*this);
@ -5236,9 +5230,6 @@ void AudacityProject::EditClipboardByLabel( EditDestFunction action )
msClipT0 = regions.front().start;
msClipT1 = regions.back().end;
if (mHistoryWindow)
mHistoryWindow->UpdateDisplay();
}

View File

@ -1,6 +1,5 @@
#include "../AdornedRulerPanel.h"
#include "../AudacityApp.h" // for EVT_CLIPBOARD_CHANGE
#include "../HistoryWindow.h"
#include "../LabelTrack.h"
#include "../Menus.h"
#include "../MixerBoard.h"
@ -240,9 +239,6 @@ void DoUndo(AudacityProject &project)
project.RedrawProject();
if (historyWindow)
historyWindow->UpdateDisplay();
if (mixerBoard)
// Mixer board may need to change for selection state and pan/gain
mixerBoard->Refresh();
@ -283,9 +279,6 @@ void OnRedo(const CommandContext &context)
project.RedrawProject();
if (historyWindow)
historyWindow->UpdateDisplay();
if (mixerBoard)
// Mixer board may need to change for selection state and pan/gain
mixerBoard->Refresh();
@ -377,9 +370,6 @@ void OnCut(const CommandContext &context)
ruler->DrawOverlays( true );
project.RedrawProject();
if (historyWindow)
historyWindow->UpdateDisplay();
}
void OnDelete(const CommandContext &context)
@ -424,9 +414,6 @@ void OnCopy(const CommandContext &context)
//Make sure the menus/toolbar states get updated
trackPanel->Refresh(false);
if (historyWindow)
historyWindow->UpdateDisplay();
}
void OnPaste(const CommandContext &context)
@ -766,9 +753,6 @@ void OnSplitCut(const CommandContext &context)
project.PushState(_("Split-cut to the clipboard"), _("Split Cut"));
project.RedrawProject();
if (historyWindow)
historyWindow->UpdateDisplay();
}
void OnSplitDelete(const CommandContext &context)

View File

@ -191,7 +191,6 @@ void OnHistory(const CommandContext &context)
auto historyWindow = project.GetHistoryWindow(true);
historyWindow->Show();
historyWindow->Raise();
historyWindow->UpdateDisplay();
}
void OnKaraoke(const CommandContext &context)