mirror of
https://github.com/cookiengineer/audacity
synced 2025-12-01 14:20:10 +01:00
TrackPanel listens for Undo events, doesn't intrude in ProjectHistory
This commit is contained in:
@@ -15,7 +15,6 @@ Paul Licameli split from ProjectManager.cpp
|
|||||||
#include "ProjectFileIO.h"
|
#include "ProjectFileIO.h"
|
||||||
#include "Tags.h"
|
#include "Tags.h"
|
||||||
#include "Track.h"
|
#include "Track.h"
|
||||||
#include "TrackPanel.h"
|
|
||||||
#include "UndoManager.h"
|
#include "UndoManager.h"
|
||||||
#include "ViewInfo.h"
|
#include "ViewInfo.h"
|
||||||
#include "ondemand/ODComputeSummaryTask.h"
|
#include "ondemand/ODComputeSummaryTask.h"
|
||||||
@@ -183,12 +182,8 @@ void ProjectHistory::PopState(const UndoState &state)
|
|||||||
void ProjectHistory::SetStateTo(unsigned int n)
|
void ProjectHistory::SetStateTo(unsigned int n)
|
||||||
{
|
{
|
||||||
auto &project = mProject;
|
auto &project = mProject;
|
||||||
auto &trackPanel = TrackPanel::Get( project );
|
|
||||||
auto &undoManager = UndoManager::Get( project );
|
auto &undoManager = UndoManager::Get( project );
|
||||||
|
|
||||||
undoManager.SetStateTo(n,
|
undoManager.SetStateTo(n,
|
||||||
[this]( const UndoState &state ){ PopState(state); } );
|
[this]( const UndoState &state ){ PopState(state); } );
|
||||||
|
|
||||||
trackPanel.SetFocusedTrack(NULL);
|
|
||||||
trackPanel.Refresh(false);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,6 +78,8 @@ is time to refresh some aspect of the screen.
|
|||||||
#include "TrackPanelResizeHandle.h"
|
#include "TrackPanelResizeHandle.h"
|
||||||
//#define DEBUG_DRAW_TIMING 1
|
//#define DEBUG_DRAW_TIMING 1
|
||||||
|
|
||||||
|
#include "UndoManager.h"
|
||||||
|
|
||||||
#include "AColor.h"
|
#include "AColor.h"
|
||||||
#include "AllThemeResources.h"
|
#include "AllThemeResources.h"
|
||||||
#include "AudioIO.h"
|
#include "AudioIO.h"
|
||||||
@@ -320,6 +322,8 @@ TrackPanel::TrackPanel(wxWindow * parent, wxWindowID id,
|
|||||||
theProject->Bind(
|
theProject->Bind(
|
||||||
EVT_PROJECT_SETTINGS_CHANGE, &TrackPanel::OnProjectSettingsChange, this);
|
EVT_PROJECT_SETTINGS_CHANGE, &TrackPanel::OnProjectSettingsChange, this);
|
||||||
|
|
||||||
|
theProject->Bind(EVT_UNDO_RESET, &TrackPanel::OnUndoReset, this);
|
||||||
|
|
||||||
UpdatePrefs();
|
UpdatePrefs();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -554,6 +558,13 @@ double TrackPanel::GetScreenEndTime() const
|
|||||||
return mViewInfo->PositionToTime(width, 0, true);
|
return mViewInfo->PositionToTime(width, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TrackPanel::OnUndoReset( wxCommandEvent &event )
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
SetFocusedTrack( nullptr );
|
||||||
|
Refresh( false );
|
||||||
|
}
|
||||||
|
|
||||||
/// AS: OnPaint( ) is called during the normal course of
|
/// AS: OnPaint( ) is called during the normal course of
|
||||||
/// completing a repaint operation.
|
/// completing a repaint operation.
|
||||||
void TrackPanel::OnPaint(wxPaintEvent & /* event */)
|
void TrackPanel::OnPaint(wxPaintEvent & /* event */)
|
||||||
|
|||||||
@@ -295,6 +295,8 @@ class AUDACITY_DLL_API TrackPanel final
|
|||||||
// Either argument may be NULL
|
// Either argument may be NULL
|
||||||
void GetTracksUsableArea(int *width, int *height) const;
|
void GetTracksUsableArea(int *width, int *height) const;
|
||||||
|
|
||||||
|
void OnUndoReset( wxCommandEvent &event );
|
||||||
|
|
||||||
void Refresh
|
void Refresh
|
||||||
(bool eraseBackground = true, const wxRect *rect = (const wxRect *) NULL)
|
(bool eraseBackground = true, const wxRect *rect = (const wxRect *) NULL)
|
||||||
override;
|
override;
|
||||||
|
|||||||
Reference in New Issue
Block a user