static ViewInfo::Get() and ZoomInfo::Get()...
... not member functions of AudacityProject
This commit is contained in:
parent
14ab93a01f
commit
b5a57682b6
|
@ -37,6 +37,7 @@
|
|||
#include "TrackPanel.h"
|
||||
#include "TrackPanelMouseEvent.h"
|
||||
#include "UIHandle.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "prefs/TracksBehaviorsPrefs.h"
|
||||
#include "prefs/TracksPrefs.h"
|
||||
#include "toolbars/ControlToolBar.h"
|
||||
|
@ -202,7 +203,7 @@ void AdornedRulerPanel::QuickPlayRulerOverlay::Update()
|
|||
&& (!project->GetScrubber().IsScrubbing() || project->GetScrubber().IsSpeedPlaying()))
|
||||
mNewQPIndicatorPos = -1;
|
||||
else {
|
||||
const auto &selectedRegion = project->GetViewInfo().selectedRegion;
|
||||
const auto &selectedRegion = ViewInfo::Get( *project ).selectedRegion;
|
||||
double latestEnd =
|
||||
std::max(ruler->mTracks->GetEndTime(), selectedRegion.t1());
|
||||
if (ruler->mQuickPlayPos >= latestEnd)
|
||||
|
@ -1245,7 +1246,7 @@ auto AdornedRulerPanel::QPHandle::Click
|
|||
mParent->mPlayRegionLock = mParent->mProject->IsPlayRegionLocked();
|
||||
|
||||
// Save old selection, in case drag of selection is cancelled
|
||||
mOldSelection = pProject->GetViewInfo().selectedRegion;
|
||||
mOldSelection = ViewInfo::Get( *pProject ).selectedRegion;
|
||||
|
||||
mParent->HandleQPClick( event.event, mX );
|
||||
mParent->HandleQPDrag( event.event, mX );
|
||||
|
@ -1479,7 +1480,8 @@ void AdornedRulerPanel::HandleQPRelease(wxMouseEvent &evt)
|
|||
|
||||
const double t0 = mTracks->GetStartTime();
|
||||
const double t1 = mTracks->GetEndTime();
|
||||
const auto &selectedRegion = mProject->GetViewInfo().selectedRegion;
|
||||
auto &viewInfo = ViewInfo::Get( *GetProject() );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
const double sel0 = selectedRegion.t0();
|
||||
const double sel1 = selectedRegion.t1();
|
||||
|
||||
|
@ -1528,7 +1530,7 @@ auto AdornedRulerPanel::QPHandle::Cancel
|
|||
|
||||
if (mClicked == Button::Left) {
|
||||
if( mParent ) {
|
||||
pProject->GetViewInfo().selectedRegion = mOldSelection;
|
||||
ViewInfo::Get( *pProject ).selectedRegion = mOldSelection;
|
||||
mParent->mMouseEventState = mesNone;
|
||||
mParent->SetPlayRegion(
|
||||
mParent->mOldPlayRegionStart, mParent->mOldPlayRegionEnd);
|
||||
|
@ -1548,7 +1550,8 @@ void AdornedRulerPanel::StartQPPlay(bool looped, bool cutPreview)
|
|||
{
|
||||
const double t0 = mTracks->GetStartTime();
|
||||
const double t1 = mTracks->GetEndTime();
|
||||
const auto &selectedRegion = mProject->GetViewInfo().selectedRegion;
|
||||
auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
const double sel0 = selectedRegion.t0();
|
||||
const double sel1 = selectedRegion.t1();
|
||||
|
||||
|
@ -1768,8 +1771,10 @@ void AdornedRulerPanel::OnSyncSelToQuickPlay(wxCommandEvent&)
|
|||
|
||||
void AdornedRulerPanel::DragSelection()
|
||||
{
|
||||
mViewInfo->selectedRegion.setT0(mPlayRegionStart, false);
|
||||
mViewInfo->selectedRegion.setT1(mPlayRegionEnd, true);
|
||||
auto &viewInfo = ViewInfo::Get( *GetProject() );
|
||||
auto &selectedRegion = viewInfo.selectedRegion;
|
||||
selectedRegion.setT0(mPlayRegionStart, false);
|
||||
selectedRegion.setT1(mPlayRegionEnd, true);
|
||||
}
|
||||
|
||||
void AdornedRulerPanel::HandleSnapping()
|
||||
|
|
|
@ -41,6 +41,7 @@ of the BlockFile system.
|
|||
#include "WaveTrack.h"
|
||||
#include "Sequence.h"
|
||||
#include "Prefs.h"
|
||||
#include "ViewInfo.h"
|
||||
|
||||
#include "FileNames.h"
|
||||
#include "widgets/AudacityMessageBox.h"
|
||||
|
|
|
@ -78,6 +78,7 @@ and in the spectrogram spectral selection.
|
|||
#include "Prefs.h"
|
||||
#include "Project.h"
|
||||
#include "WaveClip.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "AllThemeResources.h"
|
||||
|
||||
#include "FileNames.h"
|
||||
|
@ -584,10 +585,11 @@ void FreqWindow::GetAudio()
|
|||
int selcount = 0;
|
||||
bool warning = false;
|
||||
for (auto track : TrackList::Get( *p ).Selected< const WaveTrack >()) {
|
||||
auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
if (selcount==0) {
|
||||
mRate = track->GetRate();
|
||||
auto start = track->TimeToLongSamples(p->mViewInfo.selectedRegion.t0());
|
||||
auto end = track->TimeToLongSamples(p->mViewInfo.selectedRegion.t1());
|
||||
auto start = track->TimeToLongSamples(selectedRegion.t0());
|
||||
auto end = track->TimeToLongSamples(selectedRegion.t1());
|
||||
auto dataLen = end - start;
|
||||
if (dataLen > 10485760) {
|
||||
warning = true;
|
||||
|
@ -608,7 +610,7 @@ void FreqWindow::GetAudio()
|
|||
mDataLen = 0;
|
||||
return;
|
||||
}
|
||||
auto start = track->TimeToLongSamples(p->mViewInfo.selectedRegion.t0());
|
||||
auto start = track->TimeToLongSamples(selectedRegion.t0());
|
||||
Floats buffer2{ mDataLen };
|
||||
// Again, stop exceptions
|
||||
track->Get((samplePtr)buffer2.get(), floatSample, start, mDataLen,
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "LabelTrack.h"
|
||||
#include "Prefs.h"
|
||||
#include "Project.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "widgets/AudacityMessageBox.h"
|
||||
#include "widgets/ErrorDialog.h"
|
||||
#include "widgets/Grid.h"
|
||||
|
|
|
@ -67,6 +67,7 @@ for drawing different aspects of the label and its text box.
|
|||
#include "TrackArtist.h"
|
||||
#include "TrackPanel.h"
|
||||
#include "UndoManager.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "commands/CommandManager.h"
|
||||
|
||||
#include "effects/TimeWarper.h"
|
||||
|
@ -1782,8 +1783,9 @@ bool LabelTrack::DoCaptureKey(wxKeyEvent & event)
|
|||
#endif
|
||||
|
||||
// If there's a label there already don't capture
|
||||
if( GetLabelIndex(pProj->mViewInfo.selectedRegion.t0(),
|
||||
pProj->mViewInfo.selectedRegion.t1()) != wxNOT_FOUND ) {
|
||||
auto &selectedRegion = ViewInfo::Get( *pProj ).selectedRegion;
|
||||
if( GetLabelIndex(selectedRegion.t0(),
|
||||
selectedRegion.t1()) != wxNOT_FOUND ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -2117,21 +2119,22 @@ bool LabelTrack::OnChar(SelectedRegion &WXUNUSED(newSel), wxKeyEvent & event)
|
|||
bool useDialog;
|
||||
AudacityProject *p = GetActiveProject();
|
||||
gPrefs->Read(wxT("/GUI/DialogForNameNewLabel"), &useDialog, false);
|
||||
auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
if (useDialog) {
|
||||
wxString title;
|
||||
if (DialogForLabelName(
|
||||
*p, p->mViewInfo.selectedRegion, charCode, title) ==
|
||||
*p, selectedRegion, charCode, title) ==
|
||||
wxID_CANCEL) {
|
||||
return false;
|
||||
}
|
||||
SetSelected(true);
|
||||
AddLabel(p->mViewInfo.selectedRegion, title, -2);
|
||||
AddLabel(selectedRegion, title, -2);
|
||||
p->PushState(_("Added label"), _("Label"));
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
SetSelected(true);
|
||||
AddLabel(p->mViewInfo.selectedRegion);
|
||||
AddLabel(selectedRegion);
|
||||
p->PushState(_("Added label"), _("Label"));
|
||||
}
|
||||
}
|
||||
|
@ -2218,7 +2221,7 @@ void LabelTrack::ShowContextMenu()
|
|||
void LabelTrack::OnContextMenu(wxCommandEvent & evt)
|
||||
{
|
||||
AudacityProject *p = GetActiveProject();
|
||||
auto &selectedRegion = p->GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
|
||||
switch (evt.GetId())
|
||||
{
|
||||
|
@ -3087,7 +3090,7 @@ void LabelTrack::DoEditLabels
|
|||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto rate = project.GetRate();
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
LabelDialog dlg(&project, *trackFactory, &tracks,
|
||||
lt, index,
|
||||
|
@ -3108,7 +3111,7 @@ int LabelTrack::DialogForLabelName(
|
|||
const SelectedRegion& region, const wxString& initialValue, wxString& value)
|
||||
{
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
wxPoint position =
|
||||
trackPanel->FindTrackRect(trackPanel->GetFocusedTrack()).GetBottomLeft();
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include "LabelTrack.h"
|
||||
#include "commands/CommandManager.h"
|
||||
#include "UndoManager.h"
|
||||
#include "ViewInfo.h"
|
||||
|
||||
|
||||
BEGIN_EVENT_TABLE(HighlightTextCtrl, wxTextCtrl)
|
||||
|
@ -56,13 +57,13 @@ void HighlightTextCtrl::OnMouseEvent(wxMouseEvent& event)
|
|||
{
|
||||
Syllable* pCurSyl = mLyricsPanel->GetSyllable(nNewSyl);
|
||||
AudacityProject* pProj = GetActiveProject();
|
||||
auto &selectedRegion = pProj->GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( *pProj ).selectedRegion;
|
||||
selectedRegion.setT0( pCurSyl->t );
|
||||
|
||||
//v Should probably select to end as in
|
||||
// SelectActions::Handler::OnSelectCursorEnd,
|
||||
// but better to generalize that in AudacityProject methods.
|
||||
pProj->mViewInfo.selectedRegion.setT1(pCurSyl->t);
|
||||
selectedRegion.setT1( pCurSyl->t );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -439,7 +440,7 @@ void LyricsPanel::Update(double t)
|
|||
// TrackPanel::OnTimer passes gAudioIO->GetStreamTime(), which is -DBL_MAX if !IsStreamActive().
|
||||
// In that case, use the selection start time.
|
||||
AudacityProject* pProj = GetActiveProject();
|
||||
const auto &selectedRegion = pProj->GetViewInfo().selectedRegion;
|
||||
const auto &selectedRegion = ViewInfo::Get( *pProj ).selectedRegion;
|
||||
mT = selectedRegion.t0();
|
||||
}
|
||||
else
|
||||
|
@ -504,7 +505,7 @@ void LyricsPanel::UpdateLyrics(wxEvent &e)
|
|||
|
||||
AddLabels(pLabelTrack);
|
||||
Finish(pLabelTrack->GetEndTime());
|
||||
const auto &selectedRegion = mProject->GetViewInfo().selectedRegion;
|
||||
const auto &selectedRegion = ViewInfo::Get( *mProject ).selectedRegion;
|
||||
Update(selectedRegion.t0());
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "Prefs.h" // for RTL_WORKAROUND
|
||||
#include "Project.h"
|
||||
#include "TrackPanel.h" // for EVT_TRACK_PANEL_TIMER
|
||||
#include "ViewInfo.h"
|
||||
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/toolbar.h>
|
||||
|
@ -158,7 +159,7 @@ void LyricsWindow::OnTimer(wxCommandEvent &event)
|
|||
else
|
||||
{
|
||||
// Reset lyrics display.
|
||||
const auto &selectedRegion = mProject->GetViewInfo().selectedRegion;
|
||||
const auto &selectedRegion = ViewInfo::Get( *mProject ).selectedRegion;
|
||||
GetLyricsPanel()->Update(selectedRegion.t0());
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "Project.h"
|
||||
#include "TrackPanel.h"
|
||||
#include "UndoManager.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "commands/CommandManager.h"
|
||||
#include "effects/EffectManager.h"
|
||||
#include "prefs/TracksPrefs.h"
|
||||
|
@ -427,7 +428,7 @@ CommandFlag MenuManager::GetUpdateFlags
|
|||
return flags;
|
||||
}
|
||||
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
|
||||
if (!selectedRegion.isPoint())
|
||||
|
@ -506,10 +507,10 @@ CommandFlag MenuManager::GetUpdateFlags
|
|||
if (project.RedoAvailable())
|
||||
flags |= RedoAvailableFlag;
|
||||
|
||||
if (project.GetViewInfo().ZoomInAvailable() && (flags & TracksExistFlag))
|
||||
if (ViewInfo::Get( project ).ZoomInAvailable() && (flags & TracksExistFlag))
|
||||
flags |= ZoomInAvailableFlag;
|
||||
|
||||
if (project.GetViewInfo().ZoomOutAvailable() && (flags & TracksExistFlag))
|
||||
if (ViewInfo::Get( project ).ZoomOutAvailable() && (flags & TracksExistFlag))
|
||||
flags |= ZoomOutAvailableFlag;
|
||||
|
||||
// TextClipFlag is currently unused (Jan 2017, 2.1.3 alpha)
|
||||
|
|
290
src/Project.cpp
290
src/Project.cpp
|
@ -126,6 +126,7 @@ scroll information. It also has some status flags.
|
|||
#include "TimeTrack.h"
|
||||
#include "TrackPanel.h"
|
||||
#include "WaveClip.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "DirManager.h"
|
||||
#include "prefs/PrefsDialog.h"
|
||||
#include "widgets/LinkingHtmlWindow.h"
|
||||
|
@ -1046,7 +1047,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||
const wxPoint & pos,
|
||||
const wxSize & size)
|
||||
: wxFrame(parent, id, _TS("Audacity"), pos, size),
|
||||
mViewInfo(0.0, 1.0, ZoomInfo::GetDefaultZoom()),
|
||||
mbLoadedFromAup( false ),
|
||||
mDefaultFormat(QualityPrefs::SampleFormatChoice()),
|
||||
mSnapTo(gPrefs->Read(wxT("/SnapTo"), SNAP_OFF)),
|
||||
|
@ -1100,9 +1100,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||
|
||||
mLastSavedTracks.reset();
|
||||
|
||||
//
|
||||
// Initialize view info (shared with TrackPanel)
|
||||
//
|
||||
auto &viewInfo = ViewInfo::Get( *this );
|
||||
|
||||
mMenuManager = std::make_unique<MenuManager>();
|
||||
|
||||
|
@ -1157,7 +1155,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||
wxID_ANY,
|
||||
wxDefaultPosition,
|
||||
wxSize( -1, AdornedRulerPanel::GetRulerHeight(false) ),
|
||||
&mViewInfo );
|
||||
&viewInfo );
|
||||
mRuler->SetLayoutDirection(wxLayout_LeftToRight);
|
||||
|
||||
//
|
||||
|
@ -1233,7 +1231,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||
wxDefaultPosition,
|
||||
wxDefaultSize,
|
||||
tracks.shared_from_this(),
|
||||
&mViewInfo,
|
||||
&viewInfo,
|
||||
this,
|
||||
mRuler);
|
||||
}
|
||||
|
@ -1251,10 +1249,6 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||
|
||||
mIndicatorOverlay = std::make_shared<PlayIndicatorOverlay>(this);
|
||||
|
||||
this->Bind(EVT_TRACK_PANEL_TIMER,
|
||||
&ViewInfo::OnTimer,
|
||||
&mViewInfo);
|
||||
|
||||
// Add the overlays
|
||||
mTrackPanel->AddOverlay( mIndicatorOverlay );
|
||||
mTrackPanel->AddOverlay( mCursorOverlay );
|
||||
|
@ -1362,7 +1356,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||
#endif
|
||||
mIconized = false;
|
||||
|
||||
mTrackFactory.reset(safenew TrackFactory{ mDirManager, &mViewInfo });
|
||||
mTrackFactory.reset(safenew TrackFactory{ mDirManager, &viewInfo });
|
||||
|
||||
int widths[] = {0, GetControlToolBar()->WidthForStatusBar(mStatusBar), -1, 150};
|
||||
mStatusBar->SetStatusWidths(4, widths);
|
||||
|
@ -1595,7 +1589,9 @@ void AudacityProject::SetProjectTitle( int number)
|
|||
bool AudacityProject::SnapSelection()
|
||||
{
|
||||
if (mSnapTo != SNAP_OFF) {
|
||||
SelectedRegion &selectedRegion = mViewInfo.selectedRegion;
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
SelectedRegion &selectedRegion = viewInfo.selectedRegion;
|
||||
NumericConverter nc(NumericConverter::TIME, GetSelectionFormat(), 0, GetRate());
|
||||
const bool nearest = (mSnapTo == SNAP_NEAREST);
|
||||
|
||||
|
@ -1707,12 +1703,15 @@ void AudacityProject::SSBL_SetBandwidthSelectionFormatName(const NumericFormatSy
|
|||
void AudacityProject::SSBL_ModifySpectralSelection(double &bottom, double &top, bool done)
|
||||
{
|
||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
double nyq = SSBL_GetRate() / 2.0;
|
||||
if (bottom >= 0.0)
|
||||
bottom = std::min(nyq, bottom);
|
||||
if (top >= 0.0)
|
||||
top = std::min(nyq, top);
|
||||
mViewInfo.selectedRegion.setFrequencies(bottom, top);
|
||||
viewInfo.selectedRegion.setFrequencies(bottom, top);
|
||||
mTrackPanel->Refresh(false);
|
||||
if (done) {
|
||||
ModifyState(false);
|
||||
|
@ -1768,7 +1767,9 @@ const NumericFormatSymbol & AudacityProject::GetSelectionFormat() const
|
|||
|
||||
void AudacityProject::AS_ModifySelection(double &start, double &end, bool done)
|
||||
{
|
||||
mViewInfo.selectedRegion.setTimes(start, end);
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
viewInfo.selectedRegion.setTimes(start, end);
|
||||
mTrackPanel->Refresh(false);
|
||||
if (done) {
|
||||
ModifyState(false);
|
||||
|
@ -1794,12 +1795,14 @@ void AudacityProject::FinishAutoScroll()
|
|||
///
|
||||
void AudacityProject::OnScrollLeft()
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
wxInt64 pos = mHsbar->GetThumbPosition();
|
||||
// move at least one scroll increment
|
||||
pos -= wxMax((wxInt64)(sbarHjump * mViewInfo.sbarScale), 1);
|
||||
pos -= wxMax((wxInt64)(sbarHjump * viewInfo.sbarScale), 1);
|
||||
pos = wxMax(pos, 0);
|
||||
mViewInfo.sbarH -= sbarHjump;
|
||||
mViewInfo.sbarH = std::max(mViewInfo.sbarH,
|
||||
viewInfo.sbarH -= sbarHjump;
|
||||
viewInfo.sbarH = std::max(viewInfo.sbarH,
|
||||
-(wxInt64) PixelWidthBeforeTime(0.0));
|
||||
|
||||
|
||||
|
@ -1815,16 +1818,18 @@ void AudacityProject::OnScrollLeft()
|
|||
|
||||
void AudacityProject::OnScrollRight()
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
wxInt64 pos = mHsbar->GetThumbPosition();
|
||||
// move at least one scroll increment
|
||||
// use wxInt64 for calculation to prevent temporary overflow
|
||||
pos += wxMax((wxInt64)(sbarHjump * mViewInfo.sbarScale), 1);
|
||||
pos += wxMax((wxInt64)(sbarHjump * viewInfo.sbarScale), 1);
|
||||
wxInt64 max = mHsbar->GetRange() - mHsbar->GetThumbSize();
|
||||
pos = wxMin(pos, max);
|
||||
mViewInfo.sbarH += sbarHjump;
|
||||
mViewInfo.sbarH = std::min(mViewInfo.sbarH,
|
||||
mViewInfo.sbarTotal
|
||||
- (wxInt64) PixelWidthBeforeTime(0.0) - mViewInfo.sbarScreen);
|
||||
viewInfo.sbarH += sbarHjump;
|
||||
viewInfo.sbarH = std::min(viewInfo.sbarH,
|
||||
viewInfo.sbarTotal
|
||||
- (wxInt64) PixelWidthBeforeTime(0.0) - viewInfo.sbarScreen);
|
||||
|
||||
if (pos != mHsbar->GetThumbPosition()) {
|
||||
mHsbar->SetThumbPosition((int)pos);
|
||||
|
@ -1837,12 +1842,14 @@ void AudacityProject::OnScrollRight()
|
|||
///
|
||||
void AudacityProject::OnScrollLeftButton(wxScrollEvent & /*event*/)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
wxInt64 pos = mHsbar->GetThumbPosition();
|
||||
// move at least one scroll increment
|
||||
pos -= wxMax((wxInt64)(sbarHjump * mViewInfo.sbarScale), 1);
|
||||
pos -= wxMax((wxInt64)(sbarHjump * viewInfo.sbarScale), 1);
|
||||
pos = wxMax(pos, 0);
|
||||
mViewInfo.sbarH -= sbarHjump;
|
||||
mViewInfo.sbarH = std::max(mViewInfo.sbarH,
|
||||
viewInfo.sbarH -= sbarHjump;
|
||||
viewInfo.sbarH = std::max(viewInfo.sbarH,
|
||||
- (wxInt64) PixelWidthBeforeTime(0.0));
|
||||
|
||||
if (pos != mHsbar->GetThumbPosition()) {
|
||||
|
@ -1856,16 +1863,18 @@ void AudacityProject::OnScrollLeftButton(wxScrollEvent & /*event*/)
|
|||
///
|
||||
void AudacityProject::OnScrollRightButton(wxScrollEvent & /*event*/)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
wxInt64 pos = mHsbar->GetThumbPosition();
|
||||
// move at least one scroll increment
|
||||
// use wxInt64 for calculation to prevent temporary overflow
|
||||
pos += wxMax((wxInt64)(sbarHjump * mViewInfo.sbarScale), 1);
|
||||
pos += wxMax((wxInt64)(sbarHjump * viewInfo.sbarScale), 1);
|
||||
wxInt64 max = mHsbar->GetRange() - mHsbar->GetThumbSize();
|
||||
pos = wxMin(pos, max);
|
||||
mViewInfo.sbarH += sbarHjump;
|
||||
mViewInfo.sbarH = std::min(mViewInfo.sbarH,
|
||||
mViewInfo.sbarTotal
|
||||
- (wxInt64) PixelWidthBeforeTime(0.0) - mViewInfo.sbarScreen);
|
||||
viewInfo.sbarH += sbarHjump;
|
||||
viewInfo.sbarH = std::min(viewInfo.sbarH,
|
||||
viewInfo.sbarTotal
|
||||
- (wxInt64) PixelWidthBeforeTime(0.0) - viewInfo.sbarScreen);
|
||||
|
||||
if (pos != mHsbar->GetThumbPosition()) {
|
||||
mHsbar->SetThumbPosition((int)pos);
|
||||
|
@ -1876,7 +1885,9 @@ void AudacityProject::OnScrollRightButton(wxScrollEvent & /*event*/)
|
|||
|
||||
bool AudacityProject::MayScrollBeyondZero() const
|
||||
{
|
||||
if (mViewInfo.bScrollBeyondZero)
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
if (viewInfo.bScrollBeyondZero)
|
||||
return true;
|
||||
|
||||
if (GetScrubber().HasMark() ||
|
||||
|
@ -1896,9 +1907,10 @@ double AudacityProject::ScrollingLowerBoundTime() const
|
|||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
if (!MayScrollBeyondZero())
|
||||
return 0;
|
||||
const double screen = mTrackPanel->GetScreenEndTime() - mViewInfo.h;
|
||||
const double screen = mTrackPanel->GetScreenEndTime() - viewInfo.h;
|
||||
return std::min(tracks.GetStartTime(), -screen);
|
||||
}
|
||||
|
||||
|
@ -1906,27 +1918,31 @@ double AudacityProject::ScrollingLowerBoundTime() const
|
|||
// That's why ViewInfo::TimeRangeToPixelWidth was defined, with some regret.
|
||||
double AudacityProject::PixelWidthBeforeTime(double scrollto) const
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const double lowerBound = ScrollingLowerBoundTime();
|
||||
return
|
||||
// Ignoring fisheye is correct here
|
||||
mViewInfo.TimeRangeToPixelWidth(scrollto - lowerBound);
|
||||
viewInfo.TimeRangeToPixelWidth(scrollto - lowerBound);
|
||||
}
|
||||
|
||||
void AudacityProject::SetHorizontalThumb(double scrollto)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto unscaled = PixelWidthBeforeTime(scrollto);
|
||||
const int max = mHsbar->GetRange() - mHsbar->GetThumbSize();
|
||||
const int pos =
|
||||
std::min(max,
|
||||
std::max(0,
|
||||
(int)(floor(0.5 + unscaled * mViewInfo.sbarScale))));
|
||||
(int)(floor(0.5 + unscaled * viewInfo.sbarScale))));
|
||||
mHsbar->SetThumbPosition(pos);
|
||||
mViewInfo.sbarH = floor(0.5 + unscaled - PixelWidthBeforeTime(0.0));
|
||||
mViewInfo.sbarH = std::max(mViewInfo.sbarH,
|
||||
viewInfo.sbarH = floor(0.5 + unscaled - PixelWidthBeforeTime(0.0));
|
||||
viewInfo.sbarH = std::max(viewInfo.sbarH,
|
||||
- (wxInt64) PixelWidthBeforeTime(0.0));
|
||||
mViewInfo.sbarH = std::min(mViewInfo.sbarH,
|
||||
mViewInfo.sbarTotal
|
||||
- (wxInt64) PixelWidthBeforeTime(0.0) - mViewInfo.sbarScreen);
|
||||
viewInfo.sbarH = std::min(viewInfo.sbarH,
|
||||
viewInfo.sbarTotal
|
||||
- (wxInt64) PixelWidthBeforeTime(0.0) - viewInfo.sbarScreen);
|
||||
}
|
||||
|
||||
//
|
||||
|
@ -1977,6 +1993,7 @@ void AudacityProject::FixScrollbars()
|
|||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
bool refresh = false;
|
||||
bool rescroll = false;
|
||||
|
@ -2007,10 +2024,10 @@ void AudacityProject::FixScrollbars()
|
|||
LastTime = std::max( LastTime, track->GetEndTime() );
|
||||
}
|
||||
LastTime =
|
||||
std::max(LastTime, mViewInfo.selectedRegion.t1());
|
||||
std::max(LastTime, viewInfo.selectedRegion.t1());
|
||||
|
||||
const double screen =
|
||||
GetTrackPanel()->GetScreenEndTime() - mViewInfo.h;
|
||||
GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
|
||||
const double halfScreen = screen / 2.0;
|
||||
|
||||
// If we can scroll beyond zero,
|
||||
|
@ -2024,19 +2041,19 @@ void AudacityProject::FixScrollbars()
|
|||
? -lowerBound + std::max(halfScreen, screen - LastTime)
|
||||
: screen / 4.0;
|
||||
|
||||
mViewInfo.total = LastTime + additional;
|
||||
viewInfo.total = LastTime + additional;
|
||||
|
||||
// Don't remove time from total that's still on the screen
|
||||
mViewInfo.total = std::max(mViewInfo.total, mViewInfo.h + screen);
|
||||
viewInfo.total = std::max(viewInfo.total, viewInfo.h + screen);
|
||||
|
||||
if (mViewInfo.h < lowerBound) {
|
||||
mViewInfo.h = lowerBound;
|
||||
if (viewInfo.h < lowerBound) {
|
||||
viewInfo.h = lowerBound;
|
||||
rescroll = true;
|
||||
}
|
||||
|
||||
mViewInfo.sbarTotal = (wxInt64) (mViewInfo.GetTotalWidth());
|
||||
mViewInfo.sbarScreen = (wxInt64)(panelWidth);
|
||||
mViewInfo.sbarH = (wxInt64) (mViewInfo.GetBeforeScreenWidth());
|
||||
viewInfo.sbarTotal = (wxInt64) (viewInfo.GetTotalWidth());
|
||||
viewInfo.sbarScreen = (wxInt64)(panelWidth);
|
||||
viewInfo.sbarH = (wxInt64) (viewInfo.GetBeforeScreenWidth());
|
||||
|
||||
// PRL: Can someone else find a more elegant solution to bug 812, than
|
||||
// introducing this boolean member variable?
|
||||
|
@ -2045,19 +2062,19 @@ void AudacityProject::FixScrollbars()
|
|||
// mbInitializingScrollbar should be true only at the start of the life
|
||||
// of an AudacityProject reopened from disk.
|
||||
if (!mbInitializingScrollbar) {
|
||||
mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
|
||||
viewInfo.vpos = mVsbar->GetThumbPosition() * viewInfo.scrollStep;
|
||||
}
|
||||
mbInitializingScrollbar = false;
|
||||
|
||||
if (mViewInfo.vpos >= totalHeight)
|
||||
mViewInfo.vpos = totalHeight - 1;
|
||||
if (mViewInfo.vpos < 0)
|
||||
mViewInfo.vpos = 0;
|
||||
if (viewInfo.vpos >= totalHeight)
|
||||
viewInfo.vpos = totalHeight - 1;
|
||||
if (viewInfo.vpos < 0)
|
||||
viewInfo.vpos = 0;
|
||||
|
||||
bool oldhstate;
|
||||
bool oldvstate;
|
||||
bool newhstate =
|
||||
(GetTrackPanel()->GetScreenEndTime() - mViewInfo.h) < mViewInfo.total;
|
||||
(GetTrackPanel()->GetScreenEndTime() - viewInfo.h) < viewInfo.total;
|
||||
bool newvstate = panelHeight < totalHeight;
|
||||
|
||||
#ifdef __WXGTK__
|
||||
|
@ -2072,14 +2089,14 @@ void AudacityProject::FixScrollbars()
|
|||
mVsbar->Enable(panelHeight < totalHeight);
|
||||
#endif
|
||||
|
||||
if (panelHeight >= totalHeight && mViewInfo.vpos != 0) {
|
||||
mViewInfo.vpos = 0;
|
||||
if (panelHeight >= totalHeight && viewInfo.vpos != 0) {
|
||||
viewInfo.vpos = 0;
|
||||
|
||||
refresh = true;
|
||||
rescroll = false;
|
||||
}
|
||||
if (!newhstate && mViewInfo.sbarH != 0) {
|
||||
mViewInfo.sbarH = 0;
|
||||
if (!newhstate && viewInfo.sbarH != 0) {
|
||||
viewInfo.sbarH = 0;
|
||||
|
||||
refresh = true;
|
||||
rescroll = false;
|
||||
|
@ -2093,30 +2110,30 @@ void AudacityProject::FixScrollbars()
|
|||
// Don't use the full 2^31 max int range but a bit less, so rounding
|
||||
// errors in calculations do not overflow max int
|
||||
wxInt64 maxScrollbarRange = (wxInt64)(2147483647 * 0.999);
|
||||
if (mViewInfo.sbarTotal > maxScrollbarRange)
|
||||
mViewInfo.sbarScale = ((double)maxScrollbarRange) / mViewInfo.sbarTotal;
|
||||
if (viewInfo.sbarTotal > maxScrollbarRange)
|
||||
viewInfo.sbarScale = ((double)maxScrollbarRange) / viewInfo.sbarTotal;
|
||||
else
|
||||
mViewInfo.sbarScale = 1.0; // use maximum resolution
|
||||
viewInfo.sbarScale = 1.0; // use maximum resolution
|
||||
|
||||
{
|
||||
int scaledSbarH = (int)(mViewInfo.sbarH * mViewInfo.sbarScale);
|
||||
int scaledSbarScreen = (int)(mViewInfo.sbarScreen * mViewInfo.sbarScale);
|
||||
int scaledSbarTotal = (int)(mViewInfo.sbarTotal * mViewInfo.sbarScale);
|
||||
int scaledSbarH = (int)(viewInfo.sbarH * viewInfo.sbarScale);
|
||||
int scaledSbarScreen = (int)(viewInfo.sbarScreen * viewInfo.sbarScale);
|
||||
int scaledSbarTotal = (int)(viewInfo.sbarTotal * viewInfo.sbarScale);
|
||||
const int offset =
|
||||
(int)(floor(0.5 + mViewInfo.sbarScale * PixelWidthBeforeTime(0.0)));
|
||||
(int)(floor(0.5 + viewInfo.sbarScale * PixelWidthBeforeTime(0.0)));
|
||||
|
||||
mHsbar->SetScrollbar(scaledSbarH + offset, scaledSbarScreen, scaledSbarTotal,
|
||||
scaledSbarScreen, TRUE);
|
||||
}
|
||||
|
||||
// Vertical scrollbar
|
||||
mVsbar->SetScrollbar(mViewInfo.vpos / mViewInfo.scrollStep,
|
||||
panelHeight / mViewInfo.scrollStep,
|
||||
totalHeight / mViewInfo.scrollStep,
|
||||
panelHeight / mViewInfo.scrollStep, TRUE);
|
||||
mVsbar->SetScrollbar(viewInfo.vpos / viewInfo.scrollStep,
|
||||
panelHeight / viewInfo.scrollStep,
|
||||
totalHeight / viewInfo.scrollStep,
|
||||
panelHeight / viewInfo.scrollStep, TRUE);
|
||||
|
||||
if (refresh || (rescroll &&
|
||||
(GetTrackPanel()->GetScreenEndTime() - mViewInfo.h) < mViewInfo.total)) {
|
||||
(GetTrackPanel()->GetScreenEndTime() - viewInfo.h) < viewInfo.total)) {
|
||||
mTrackPanel->Refresh(false);
|
||||
}
|
||||
|
||||
|
@ -2302,32 +2319,36 @@ void AudacityProject::OnToolBarUpdate(wxCommandEvent & event)
|
|||
|
||||
void AudacityProject::OnScroll(wxScrollEvent & WXUNUSED(event))
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const wxInt64 offset = PixelWidthBeforeTime(0.0);
|
||||
mViewInfo.sbarH =
|
||||
(wxInt64)(mHsbar->GetThumbPosition() / mViewInfo.sbarScale) - offset;
|
||||
viewInfo.sbarH =
|
||||
(wxInt64)(mHsbar->GetThumbPosition() / viewInfo.sbarScale) - offset;
|
||||
DoScroll();
|
||||
}
|
||||
|
||||
void AudacityProject::DoScroll()
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const double lowerBound = ScrollingLowerBoundTime();
|
||||
|
||||
int width;
|
||||
mTrackPanel->GetTracksUsableArea(&width, NULL);
|
||||
mViewInfo.SetBeforeScreenWidth(mViewInfo.sbarH, width, lowerBound);
|
||||
viewInfo.SetBeforeScreenWidth(viewInfo.sbarH, width, lowerBound);
|
||||
|
||||
|
||||
if (MayScrollBeyondZero()) {
|
||||
enum { SCROLL_PIXEL_TOLERANCE = 10 };
|
||||
if (std::abs(mViewInfo.TimeToPosition(0.0, 0
|
||||
if (std::abs(viewInfo.TimeToPosition(0.0, 0
|
||||
)) < SCROLL_PIXEL_TOLERANCE) {
|
||||
// Snap the scrollbar to 0
|
||||
mViewInfo.h = 0;
|
||||
viewInfo.h = 0;
|
||||
SetHorizontalThumb(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
|
||||
viewInfo.vpos = mVsbar->GetThumbPosition() * viewInfo.scrollStep;
|
||||
|
||||
//mchinen: do not always set this project to be the active one.
|
||||
//a project may autoscroll while playing in the background
|
||||
|
@ -3435,6 +3456,8 @@ void AudacityProject::EnqueueODTasks()
|
|||
|
||||
bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
bool bFileVersionFound = false;
|
||||
wxString fileVersion = _("<unrecognized version -- possibly corrupt project file>");
|
||||
wxString audacityVersion = _("<unrecognized version -- possibly corrupt project file>");
|
||||
|
@ -3450,9 +3473,9 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
if (!value || !XMLValueChecker::IsGoodString(value))
|
||||
break;
|
||||
|
||||
if (mViewInfo.ReadXMLAttribute(attr, value)) {
|
||||
if (viewInfo.ReadXMLAttribute(attr, value)) {
|
||||
// We need to save vpos now and restore it below
|
||||
longVpos = std::max(longVpos, long(mViewInfo.vpos));
|
||||
longVpos = std::max(longVpos, long(viewInfo.vpos));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -3574,7 +3597,7 @@ bool AudacityProject::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
|
|||
|
||||
if (longVpos != 0) {
|
||||
// PRL: It seems this must happen after SetSnapTo
|
||||
mViewInfo.vpos = longVpos;
|
||||
viewInfo.vpos = longVpos;
|
||||
mbInitializingScrollbar = true;
|
||||
}
|
||||
|
||||
|
@ -3682,6 +3705,7 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile, bool bWantSaveCopy)
|
|||
{
|
||||
auto &proj = *this;
|
||||
auto &tracks = TrackList::Get( proj );
|
||||
auto &viewInfo = ViewInfo::Get( proj );
|
||||
|
||||
//TIMER_START( "AudacityProject::WriteXML", xml_writer_timer );
|
||||
// Warning: This block of code is duplicated in Save, for now...
|
||||
|
@ -3716,7 +3740,7 @@ void AudacityProject::WriteXML(XMLWriter &xmlFile, bool bWantSaveCopy)
|
|||
xmlFile.WriteAttr(wxT("version"), wxT(AUDACITY_FILE_FORMAT_VERSION));
|
||||
xmlFile.WriteAttr(wxT("audacityversion"), AUDACITY_VERSION_STRING);
|
||||
|
||||
mViewInfo.WriteXMLAttributes(xmlFile);
|
||||
viewInfo.WriteXMLAttributes(xmlFile);
|
||||
xmlFile.WriteAttr(wxT("rate"), mRate);
|
||||
xmlFile.WriteAttr(wxT("snapto"), GetSnapTo() ? wxT("on") : wxT("off"));
|
||||
xmlFile.WriteAttr(wxT("selectionformat"),
|
||||
|
@ -4609,11 +4633,12 @@ void AudacityProject::InitialState()
|
|||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
GetUndoManager()->ClearStates();
|
||||
|
||||
GetUndoManager()->PushState(
|
||||
&tracks, mViewInfo.selectedRegion, mTags,
|
||||
&tracks, viewInfo.selectedRegion, mTags,
|
||||
_("Created new project"), wxT(""));
|
||||
|
||||
GetUndoManager()->StateSaved();
|
||||
|
@ -4650,8 +4675,9 @@ void AudacityProject::PushState(const wxString &desc,
|
|||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
GetUndoManager()->PushState(
|
||||
&tracks, mViewInfo.selectedRegion, mTags,
|
||||
&tracks, viewInfo.selectedRegion, mTags,
|
||||
desc, shortDesc, flags);
|
||||
|
||||
mDirty = true;
|
||||
|
@ -4677,8 +4703,9 @@ void AudacityProject::ModifyState(bool bWantsAutoSave)
|
|||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
GetUndoManager()->ModifyState(
|
||||
&tracks, mViewInfo.selectedRegion, mTags);
|
||||
&tracks, viewInfo.selectedRegion, mTags);
|
||||
if (bWantsAutoSave)
|
||||
AutoSave();
|
||||
GetTrackPanel()->HandleCursorForPresentMouseState();
|
||||
|
@ -4691,8 +4718,9 @@ void AudacityProject::PopState(const UndoState &state)
|
|||
{
|
||||
auto &project = *this;
|
||||
auto &dstTracks = TrackList::Get( project );
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
mViewInfo.selectedRegion = state.selectedRegion;
|
||||
viewInfo.selectedRegion = state.selectedRegion;
|
||||
|
||||
// Restore tags
|
||||
mTags = state.tags;
|
||||
|
@ -4756,13 +4784,15 @@ void AudacityProject::SetStateTo(unsigned int n)
|
|||
// Utility function called by other zoom methods
|
||||
void AudacityProject::Zoom(double level)
|
||||
{
|
||||
mViewInfo.SetZoom(level);
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
viewInfo.SetZoom(level);
|
||||
FixScrollbars();
|
||||
// See if we can center the selection on screen, and have it actually fit.
|
||||
// tOnLeft is the amount of time we would need before the selection left edge to center it.
|
||||
float t0 = mViewInfo.selectedRegion.t0();
|
||||
float t1 = mViewInfo.selectedRegion.t1();
|
||||
float tAvailable = GetTrackPanel()->GetScreenEndTime() - mViewInfo.h;
|
||||
float t0 = viewInfo.selectedRegion.t0();
|
||||
float t1 = viewInfo.selectedRegion.t1();
|
||||
float tAvailable = GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
|
||||
float tOnLeft = (tAvailable - t0 + t1)/2.0;
|
||||
// Bug 1292 (Enh) is effectively a request to do this scrolling of the selection into view.
|
||||
// If tOnLeft is positive, then we have room for the selection, so scroll to it.
|
||||
|
@ -4773,7 +4803,9 @@ void AudacityProject::Zoom(double level)
|
|||
// Utility function called by other zoom methods
|
||||
void AudacityProject::ZoomBy(double multiplier)
|
||||
{
|
||||
mViewInfo.ZoomBy(multiplier);
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
viewInfo.ZoomBy(multiplier);
|
||||
FixScrollbars();
|
||||
}
|
||||
|
||||
|
@ -4787,9 +4819,11 @@ void AudacityProject::ZoomBy(double multiplier)
|
|||
///////////////////////////////////////////////////////////////////
|
||||
void AudacityProject::Rewind(bool shift)
|
||||
{
|
||||
mViewInfo.selectedRegion.setT0(0, false);
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
viewInfo.selectedRegion.setT0(0, false);
|
||||
if (!shift)
|
||||
mViewInfo.selectedRegion.setT1(0);
|
||||
viewInfo.selectedRegion.setT1(0);
|
||||
|
||||
TP_ScrollWindow(0);
|
||||
}
|
||||
|
@ -4807,11 +4841,12 @@ void AudacityProject::SkipEnd(bool shift)
|
|||
{
|
||||
auto &project = *this;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
double len = tracks.GetEndTime();
|
||||
|
||||
mViewInfo.selectedRegion.setT1(len, false);
|
||||
viewInfo.selectedRegion.setT1(len, false);
|
||||
if (!shift)
|
||||
mViewInfo.selectedRegion.setT0(len);
|
||||
viewInfo.selectedRegion.setT0(len);
|
||||
|
||||
// Make sure the end of the track is visible
|
||||
mTrackPanel->ScrollIntoView(len);
|
||||
|
@ -5008,12 +5043,15 @@ void AudacityProject::TP_DisplayStatusMessage(const wxString &msg)
|
|||
|
||||
void AudacityProject::TP_DisplaySelection()
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
double audioTime;
|
||||
|
||||
if (mRuler) {
|
||||
if (!gAudioIO->IsBusy() && !mLockPlayRegion)
|
||||
mRuler->SetPlayRegion(mViewInfo.selectedRegion.t0(),
|
||||
mViewInfo.selectedRegion.t1());
|
||||
mRuler->SetPlayRegion(selectedRegion.t0(),
|
||||
selectedRegion.t1());
|
||||
else
|
||||
// Cause ruler redraw anyway, because we may be zooming or scrolling
|
||||
mRuler->Refresh();
|
||||
|
@ -5026,11 +5064,11 @@ void AudacityProject::TP_DisplaySelection()
|
|||
GetPlayRegion(&audioTime, &playEnd);
|
||||
}
|
||||
|
||||
GetSelectionBar()->SetTimes(mViewInfo.selectedRegion.t0(),
|
||||
mViewInfo.selectedRegion.t1(), audioTime);
|
||||
GetSelectionBar()->SetTimes(selectedRegion.t0(),
|
||||
selectedRegion.t1(), audioTime);
|
||||
#ifdef EXPERIMENTAL_SPECTRAL_EDITING
|
||||
GetSpectralSelectionBar()->SetFrequencies
|
||||
(mViewInfo.selectedRegion.f0(), mViewInfo.selectedRegion.f1());
|
||||
GetSpectralSelectionBar()->SetFrequencies(
|
||||
selectedRegion.f0(), selectedRegion.f1());
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -5304,12 +5342,14 @@ bool AudacityProject::IsProjectSaved() {
|
|||
void AudacityProject::ResetProjectToEmpty() {
|
||||
auto &project = *this;
|
||||
auto &projectFileIO = project;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
SelectActions::DoSelectAll( project );
|
||||
TrackActions::DoRemoveTracks( project );
|
||||
|
||||
// A new DirManager.
|
||||
mDirManager = DirManager::Create();
|
||||
mTrackFactory.reset(safenew TrackFactory{ mDirManager, &mViewInfo });
|
||||
mTrackFactory.reset(safenew TrackFactory{ mDirManager, &viewInfo });
|
||||
|
||||
projectFileIO.ResetProjectFileIO();
|
||||
|
||||
|
@ -5432,7 +5472,7 @@ int AudacityProject::GetEstimatedRecordingMinsLeftOnDisk(long lCaptureChannels)
|
|||
AudacityProject::PlaybackScroller::PlaybackScroller(AudacityProject *project)
|
||||
: mProject(project)
|
||||
{
|
||||
mProject->GetViewInfo().Bind(EVT_TRACK_PANEL_TIMER,
|
||||
ViewInfo::Get( *mProject ).Bind(EVT_TRACK_PANEL_TIMER,
|
||||
&PlaybackScroller::OnTimer,
|
||||
this);
|
||||
}
|
||||
|
@ -5462,7 +5502,7 @@ void AudacityProject::PlaybackScroller::OnTimer(wxCommandEvent &event)
|
|||
// Pan the view, so that we put the play indicator at some fixed
|
||||
// fraction of the window width.
|
||||
|
||||
ViewInfo &viewInfo = mProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
TrackPanel *const trackPanel = mProject->GetTrackPanel();
|
||||
const int posX = viewInfo.TimeToPosition(viewInfo.mRecentStreamTime);
|
||||
int width;
|
||||
|
@ -5547,6 +5587,9 @@ ContrastDialog *AudacityProject::GetContrastDialog(bool create)
|
|||
|
||||
void AudacityProject::ZoomInByFactor( double ZoomFactor )
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
// LLL: Handling positioning differently when audio is
|
||||
// actively playing. Don't do this if paused.
|
||||
if ((gAudioIO->IsStreamActive(GetAudioIOToken()) != 0) &&
|
||||
|
@ -5562,34 +5605,34 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
|
|||
// partially on-screen
|
||||
|
||||
const double endTime = GetTrackPanel()->GetScreenEndTime();
|
||||
const double duration = endTime - mViewInfo.h;
|
||||
const double duration = endTime - viewInfo.h;
|
||||
|
||||
bool selectionIsOnscreen =
|
||||
(mViewInfo.selectedRegion.t0() < endTime) &&
|
||||
(mViewInfo.selectedRegion.t1() >= mViewInfo.h);
|
||||
(viewInfo.selectedRegion.t0() < endTime) &&
|
||||
(viewInfo.selectedRegion.t1() >= viewInfo.h);
|
||||
|
||||
bool selectionFillsScreen =
|
||||
(mViewInfo.selectedRegion.t0() < mViewInfo.h) &&
|
||||
(mViewInfo.selectedRegion.t1() > endTime);
|
||||
(viewInfo.selectedRegion.t0() < viewInfo.h) &&
|
||||
(viewInfo.selectedRegion.t1() > endTime);
|
||||
|
||||
if (selectionIsOnscreen && !selectionFillsScreen) {
|
||||
// Start with the center of the selection
|
||||
double selCenter = (mViewInfo.selectedRegion.t0() +
|
||||
mViewInfo.selectedRegion.t1()) / 2;
|
||||
double selCenter = (viewInfo.selectedRegion.t0() +
|
||||
viewInfo.selectedRegion.t1()) / 2;
|
||||
|
||||
// If the selection center is off-screen, pick the
|
||||
// center of the part that is on-screen.
|
||||
if (selCenter < mViewInfo.h)
|
||||
selCenter = mViewInfo.h +
|
||||
(mViewInfo.selectedRegion.t1() - mViewInfo.h) / 2;
|
||||
if (selCenter < viewInfo.h)
|
||||
selCenter = viewInfo.h +
|
||||
(viewInfo.selectedRegion.t1() - viewInfo.h) / 2;
|
||||
if (selCenter > endTime)
|
||||
selCenter = endTime -
|
||||
(endTime - mViewInfo.selectedRegion.t0()) / 2;
|
||||
(endTime - viewInfo.selectedRegion.t0()) / 2;
|
||||
|
||||
// Zoom in
|
||||
ZoomBy(ZoomFactor);
|
||||
const double newDuration =
|
||||
GetTrackPanel()->GetScreenEndTime() - mViewInfo.h;
|
||||
GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
|
||||
|
||||
// Recenter on selCenter
|
||||
TP_ScrollWindow(selCenter - newDuration / 2);
|
||||
|
@ -5597,25 +5640,25 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
|
|||
}
|
||||
|
||||
|
||||
double origLeft = mViewInfo.h;
|
||||
double origLeft = viewInfo.h;
|
||||
double origWidth = duration;
|
||||
ZoomBy(ZoomFactor);
|
||||
|
||||
const double newDuration =
|
||||
GetTrackPanel()->GetScreenEndTime() - mViewInfo.h;
|
||||
GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
|
||||
double newh = origLeft + (origWidth - newDuration) / 2;
|
||||
|
||||
// MM: Commented this out because it was confusing users
|
||||
/*
|
||||
// make sure that the *right-hand* end of the selection is
|
||||
// no further *left* than 1/3 of the way across the screen
|
||||
if (mViewInfo.selectedRegion.t1() < newh + mViewInfo.screen / 3)
|
||||
newh = mViewInfo.selectedRegion.t1() - mViewInfo.screen / 3;
|
||||
if (viewInfo.selectedRegion.t1() < newh + viewInfo.screen / 3)
|
||||
newh = viewInfo.selectedRegion.t1() - viewInfo.screen / 3;
|
||||
|
||||
// make sure that the *left-hand* end of the selection is
|
||||
// no further *right* than 2/3 of the way across the screen
|
||||
if (mViewInfo.selectedRegion.t0() > newh + mViewInfo.screen * 2 / 3)
|
||||
newh = mViewInfo.selectedRegion.t0() - mViewInfo.screen * 2 / 3;
|
||||
if (viewInfo.selectedRegion.t0() > newh + viewInfo.screen * 2 / 3)
|
||||
newh = viewInfo.selectedRegion.t0() - viewInfo.screen * 2 / 3;
|
||||
*/
|
||||
|
||||
TP_ScrollWindow(newh);
|
||||
|
@ -5623,12 +5666,15 @@ void AudacityProject::ZoomInByFactor( double ZoomFactor )
|
|||
|
||||
void AudacityProject::ZoomOutByFactor( double ZoomFactor )
|
||||
{
|
||||
auto &project = *this;
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
//Zoom() may change these, so record original values:
|
||||
const double origLeft = mViewInfo.h;
|
||||
const double origLeft = viewInfo.h;
|
||||
const double origWidth = GetTrackPanel()->GetScreenEndTime() - origLeft;
|
||||
|
||||
ZoomBy(ZoomFactor);
|
||||
const double newWidth = GetTrackPanel()->GetScreenEndTime() - mViewInfo.h;
|
||||
const double newWidth = GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
|
||||
|
||||
const double newh = origLeft + (origWidth - newWidth) / 2;
|
||||
// newh = (newh > 0) ? newh : 0;
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "ClientData.h"
|
||||
#include "Prefs.h"
|
||||
#include "SelectionState.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "commands/CommandManagerWindowClasses.h"
|
||||
|
||||
#include "TrackPanelListener.h"
|
||||
|
@ -206,9 +205,6 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
|
|||
sampleFormat GetDefaultFormat() { return mDefaultFormat; }
|
||||
|
||||
double GetRate() const { return mRate; }
|
||||
const ZoomInfo &GetZoomInfo() const { return mViewInfo; }
|
||||
const ViewInfo &GetViewInfo() const { return mViewInfo; }
|
||||
ViewInfo &GetViewInfo() { return mViewInfo; }
|
||||
|
||||
void GetPlayRegion(double* playRegionStart, double *playRegionEnd);
|
||||
bool IsPlayRegionLocked() { return mLockPlayRegion; }
|
||||
|
@ -505,8 +501,6 @@ public:
|
|||
|
||||
void WriteXMLHeader(XMLWriter &xmlFile) const;
|
||||
|
||||
ViewInfo mViewInfo;
|
||||
|
||||
// Audio IO callback methods
|
||||
void OnAudioIORate(int rate) override;
|
||||
void OnAudioIOStartRecording() override;
|
||||
|
|
|
@ -42,6 +42,7 @@ It forwards the actual work of doing the commands to the ScreenshotCommand.
|
|||
#include "Prefs.h"
|
||||
#include "toolbars/ToolManager.h"
|
||||
|
||||
#include "ViewInfo.h"
|
||||
#include "WaveTrack.h"
|
||||
|
||||
class OldStyleCommandType;
|
||||
|
@ -668,9 +669,10 @@ void ScreenFrame::OnCaptureSomething(wxCommandEvent & event)
|
|||
|
||||
void ScreenFrame::TimeZoom(double seconds)
|
||||
{
|
||||
auto &viewInfo = ViewInfo::Get( mContext.project );
|
||||
int width, height;
|
||||
mContext.project.GetClientSize(&width, &height);
|
||||
mContext.project.mViewInfo.SetZoom((0.75 * width) / seconds);
|
||||
viewInfo.SetZoom((0.75 * width) / seconds);
|
||||
mContext.project.RedrawProject();
|
||||
}
|
||||
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "LabelTrack.h"
|
||||
#include "NoteTrack.h"
|
||||
#include "WaveClip.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "WaveTrack.h"
|
||||
|
||||
inline bool operator < (SnapPoint s1, SnapPoint s2)
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "Project.h"
|
||||
#include "ProjectFileIORegistry.h"
|
||||
#include "TrackArtist.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "AllThemeResources.h"
|
||||
|
||||
//TODO-MB: are these sensible values?
|
||||
|
|
|
@ -83,6 +83,7 @@ is time to refresh some aspect of the screen.
|
|||
#include "RefreshCode.h"
|
||||
#include "TrackArtist.h"
|
||||
#include "TrackPanelAx.h"
|
||||
#include "ViewInfo.h"
|
||||
#include "WaveTrack.h"
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
#include "NoteTrack.h"
|
||||
|
@ -2844,7 +2845,7 @@ unsigned TrackPanelCell::Char(wxKeyEvent &event, ViewInfo &, wxWindow *)
|
|||
|
||||
IsVisibleTrack::IsVisibleTrack(AudacityProject *project)
|
||||
: mPanelRect {
|
||||
wxPoint{ 0, project->mViewInfo.vpos },
|
||||
wxPoint{ 0, ViewInfo::Get( *project ).vpos },
|
||||
project->GetTrackPanel()->GetTracksUsableArea()
|
||||
}
|
||||
{}
|
||||
|
|
|
@ -17,6 +17,9 @@ Paul Licameli
|
|||
#include "AudioIO.h"
|
||||
#include "prefs/GUISettings.h"
|
||||
#include "Prefs.h"
|
||||
#include "Project.h"
|
||||
#include "TrackPanel.h" // for EVT_TRACK_PANEL_TIMER
|
||||
#include "xml/XMLWriter.h"
|
||||
#include "prefs/TracksBehaviorsPrefs.h"
|
||||
#include "xml/XMLWriter.h"
|
||||
|
||||
|
@ -25,6 +28,16 @@ static const double gMaxZoom = 6000000;
|
|||
static const double gMinZoom = 0.001;
|
||||
}
|
||||
|
||||
ZoomInfo &ZoomInfo::Get( AudacityProject &project )
|
||||
{
|
||||
return ViewInfo::Get( project );
|
||||
}
|
||||
|
||||
const ZoomInfo &ZoomInfo::Get( const AudacityProject &project )
|
||||
{
|
||||
return Get( const_cast< AudacityProject & >( project ) );
|
||||
}
|
||||
|
||||
ZoomInfo::ZoomInfo(double start, double pixelsPerSecond)
|
||||
: vpos(0)
|
||||
, h(start)
|
||||
|
@ -130,6 +143,27 @@ void ZoomInfo::FindIntervals
|
|||
wxASSERT(!results.empty() && results[0].position == origin);
|
||||
}
|
||||
|
||||
static const AudacityProject::AttachedObjects::RegisteredFactory key{
|
||||
[]( AudacityProject &project ) {
|
||||
auto result =
|
||||
std::make_unique<ViewInfo>(0.0, 1.0, ZoomInfo::GetDefaultZoom());
|
||||
project.Bind(EVT_TRACK_PANEL_TIMER,
|
||||
&ViewInfo::OnTimer,
|
||||
result.get());
|
||||
return std::move( result );
|
||||
}
|
||||
};
|
||||
|
||||
ViewInfo &ViewInfo::Get( AudacityProject &project )
|
||||
{
|
||||
return project.AttachedObjects::Get< ViewInfo >( key );
|
||||
}
|
||||
|
||||
const ViewInfo &ViewInfo::Get( const AudacityProject &project )
|
||||
{
|
||||
return Get( const_cast< AudacityProject & >( project ) );
|
||||
}
|
||||
|
||||
ViewInfo::ViewInfo(double start, double screenDuration, double pixelsPerSecond)
|
||||
: ZoomInfo(start, pixelsPerSecond)
|
||||
, selectedRegion()
|
||||
|
|
|
@ -13,28 +13,33 @@
|
|||
|
||||
#include <vector>
|
||||
#include <wx/event.h> // inherit wxEvtHandler
|
||||
#include "ClientData.h"
|
||||
#include "SelectedRegion.h"
|
||||
#include "MemoryX.h"
|
||||
#include "Prefs.h"
|
||||
|
||||
|
||||
class Track;
|
||||
|
||||
#ifdef __GNUC__
|
||||
#define CONST
|
||||
#else
|
||||
#define CONST const
|
||||
#endif
|
||||
|
||||
class AudacityProject;
|
||||
|
||||
// The subset of ViewInfo information (other than selection)
|
||||
// that is sufficient for purposes of TrackArtist,
|
||||
// and for computing conversions between track times and pixel positions.
|
||||
class AUDACITY_DLL_API ZoomInfo /* not final */
|
||||
// Note that ViewInfo inherits from ZoomInfo but there are no virtual functions.
|
||||
// That's okay if we pass always by reference and never copy, suffering "slicing."
|
||||
: protected PrefsListener
|
||||
: public ClientData::Base
|
||||
, protected PrefsListener
|
||||
{
|
||||
public:
|
||||
static ZoomInfo &Get( AudacityProject &project );
|
||||
static const ZoomInfo &Get( const AudacityProject &project );
|
||||
|
||||
ZoomInfo(double start, double pixelsPerSecond);
|
||||
~ZoomInfo();
|
||||
|
||||
|
@ -146,6 +151,9 @@ class AUDACITY_DLL_API ViewInfo final
|
|||
: public wxEvtHandler, public ZoomInfo
|
||||
{
|
||||
public:
|
||||
static ViewInfo &Get( AudacityProject &project );
|
||||
static const ViewInfo &Get( const AudacityProject &project );
|
||||
|
||||
ViewInfo(double start, double screenDuration, double pixelsPerSecond);
|
||||
|
||||
static int UpdateScrollPrefsID();
|
||||
|
|
|
@ -21,7 +21,7 @@ threshold of difference in two selected tracks
|
|||
#include "../Audacity.h"
|
||||
#include "CompareAudioCommand.h"
|
||||
|
||||
#include "../Project.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
|
||||
|
||||
|
@ -61,8 +61,9 @@ void CompareAudioCommand::PopulateOrExchange(ShuttleGui & S)
|
|||
bool CompareAudioCommand::GetSelection(const CommandContext &context, AudacityProject &proj)
|
||||
{
|
||||
// Get the selected time interval
|
||||
mT0 = proj.mViewInfo.selectedRegion.t0();
|
||||
mT1 = proj.mViewInfo.selectedRegion.t1();
|
||||
auto &selectedRegion = ViewInfo::Get( proj ).selectedRegion;
|
||||
mT0 = selectedRegion.t0();
|
||||
mT1 = selectedRegion.t1();
|
||||
if (mT0 >= mT1)
|
||||
{
|
||||
context.Error(wxT("There is no selection!"));
|
||||
|
|
|
@ -30,6 +30,7 @@ This class now lists
|
|||
#include "../widgets/Overlay.h"
|
||||
#include "../TrackPanel.h"
|
||||
#include "../WaveClip.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../LabelTrack.h"
|
||||
#include "../Envelope.h"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
#include "ImportExportCommands.h"
|
||||
|
||||
#include "../Project.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../export/Export.h"
|
||||
#include "../Shuttle.h"
|
||||
#include "../ShuttleGui.h"
|
||||
|
@ -66,8 +67,9 @@ void ExportCommand::PopulateOrExchange(ShuttleGui & S)
|
|||
bool ExportCommand::Apply(const CommandContext & context)
|
||||
{
|
||||
double t0, t1;
|
||||
t0 = context.project.mViewInfo.selectedRegion.t0();
|
||||
t1 = context.project.mViewInfo.selectedRegion.t1();
|
||||
auto &selectedRegion = ViewInfo::Get( context.project ).selectedRegion;
|
||||
t0 = selectedRegion.t0();
|
||||
t1 = selectedRegion.t1();
|
||||
|
||||
// Find the extension and check it's valid
|
||||
int splitAt = mFileName.Find(wxUniChar('.'), true);
|
||||
|
|
|
@ -38,6 +38,7 @@ small calculations of rectangles.
|
|||
#include "../Prefs.h"
|
||||
#include "../Shuttle.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../Track.h"
|
||||
#include "CommandContext.h"
|
||||
#include "CommandManager.h"
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@ explicitly code all three.
|
|||
#include "../Shuttle.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../effects/Effect.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "CommandContext.h"
|
||||
|
||||
|
||||
|
@ -102,7 +103,7 @@ bool SelectTimeCommand::Apply(const CommandContext & context){
|
|||
double t0;
|
||||
double t1;
|
||||
|
||||
const auto &selectedRegion = p->GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
switch( bHasRelativeSpec ? mRelativeTo : 0 ){
|
||||
default:
|
||||
case 0: //project start
|
||||
|
@ -131,7 +132,7 @@ bool SelectTimeCommand::Apply(const CommandContext & context){
|
|||
break;
|
||||
}
|
||||
|
||||
p->mViewInfo.selectedRegion.setTimes( t0, t1);
|
||||
selectedRegion.setTimes( t0, t1 );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,8 +19,8 @@
|
|||
#include "../Audacity.h"
|
||||
#include "SetLabelCommand.h"
|
||||
|
||||
#include "../Project.h"
|
||||
#include "../TrackPanel.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../LabelTrack.h"
|
||||
#include "../Shuttle.h"
|
||||
|
@ -68,6 +68,7 @@ bool SetLabelCommand::Apply(const CommandContext & context)
|
|||
//wxString mode = GetString(wxT("Type"));
|
||||
AudacityProject * p = &context.project;
|
||||
auto &tracks = TrackList::Get( *p );
|
||||
auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
LabelStruct * pLabel = NULL;
|
||||
int i=0;
|
||||
int nn=0;
|
||||
|
@ -107,7 +108,7 @@ bool SetLabelCommand::Apply(const CommandContext & context)
|
|||
labelTrack->mSelIndex = nn-1;
|
||||
double t0 = pLabel->selectedRegion.t0();
|
||||
double t1 = pLabel->selectedRegion.t1();
|
||||
p->mViewInfo.selectedRegion.setTimes( t0, t1);
|
||||
selectedRegion.setTimes( t0, t1);
|
||||
}
|
||||
else if( labelTrack->mSelIndex == (nn-1) )
|
||||
labelTrack->mSelIndex = -1;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "../Project.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../FileNames.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../widgets/LinkingHtmlWindow.h"
|
||||
#include "../widgets/HelpSystem.h"
|
||||
#include "../widgets/NumericTextCtrl.h"
|
||||
|
@ -114,8 +115,9 @@ bool ContrastDialog::GetDB(float &dB)
|
|||
void ContrastDialog::SetStartAndEndTime()
|
||||
{
|
||||
AudacityProject *p = GetActiveProject();
|
||||
mT0 = p->mViewInfo.selectedRegion.t0();
|
||||
mT1 = p->mViewInfo.selectedRegion.t1();
|
||||
auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
mT0 = selectedRegion.t0();
|
||||
mT1 = selectedRegion.t1();
|
||||
}
|
||||
|
||||
|
||||
|
@ -345,10 +347,11 @@ void ContrastDialog::OnClose(wxCommandEvent & WXUNUSED(event))
|
|||
void ContrastDialog::OnGetForeground(wxCommandEvent & /*event*/)
|
||||
{
|
||||
AudacityProject *p = GetActiveProject();
|
||||
auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
|
||||
if( TrackList::Get( *p ).Selected< const WaveTrack >() ) {
|
||||
mForegroundStartT->SetValue(p->mViewInfo.selectedRegion.t0());
|
||||
mForegroundEndT->SetValue(p->mViewInfo.selectedRegion.t1());
|
||||
mForegroundStartT->SetValue(selectedRegion.t0());
|
||||
mForegroundEndT->SetValue(selectedRegion.t1());
|
||||
}
|
||||
|
||||
SetStartAndEndTime();
|
||||
|
@ -360,10 +363,11 @@ void ContrastDialog::OnGetForeground(wxCommandEvent & /*event*/)
|
|||
void ContrastDialog::OnGetBackground(wxCommandEvent & /*event*/)
|
||||
{
|
||||
AudacityProject *p = GetActiveProject();
|
||||
auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
|
||||
if( TrackList::Get( *p ).Selected< const WaveTrack >() ) {
|
||||
mBackgroundStartT->SetValue(p->mViewInfo.selectedRegion.t0());
|
||||
mBackgroundEndT->SetValue(p->mViewInfo.selectedRegion.t1());
|
||||
mBackgroundStartT->SetValue(selectedRegion.t0());
|
||||
mBackgroundEndT->SetValue(selectedRegion.t1());
|
||||
}
|
||||
|
||||
SetStartAndEndTime();
|
||||
|
|
|
@ -58,6 +58,7 @@ greater use in future.
|
|||
#include "../PluginManager.h"
|
||||
#include "../ShuttleGui.h"
|
||||
#include "../Shuttle.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../commands/Command.h"
|
||||
#include "../toolbars/ControlToolBar.h"
|
||||
|
@ -1892,7 +1893,7 @@ bool Effect::ProcessTrack(int count,
|
|||
// Transfer the data from the temporary tracks to the actual ones
|
||||
genLeft->Flush();
|
||||
// mT1 gives us the NEW selection. We want to replace up to GetSel1().
|
||||
auto &selectedRegion = p->GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
left->ClearAndPaste(mT0,
|
||||
selectedRegion.t1(), genLeft.get(), true, true,
|
||||
nullptr /* &warper */);
|
||||
|
@ -3271,7 +3272,7 @@ void EffectUIHost::OnApply(wxCommandEvent & evt)
|
|||
mEffect &&
|
||||
mEffect->GetType() != EffectTypeGenerate &&
|
||||
mEffect->GetType() != EffectTypeTool &&
|
||||
mProject->mViewInfo.selectedRegion.isPoint())
|
||||
ViewInfo::Get( *mProject ).selectedRegion.isPoint())
|
||||
{
|
||||
auto flags = AlwaysEnabledFlag;
|
||||
bool allowed =
|
||||
|
@ -3510,6 +3511,8 @@ void EffectUIHost::OnPlay(wxCommandEvent & WXUNUSED(evt))
|
|||
}
|
||||
else
|
||||
{
|
||||
auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
if (mProject->IsPlayRegionLocked())
|
||||
{
|
||||
double t0, t1;
|
||||
|
@ -3517,10 +3520,10 @@ void EffectUIHost::OnPlay(wxCommandEvent & WXUNUSED(evt))
|
|||
mRegion.setTimes(t0, t1);
|
||||
mPlayPos = mRegion.t0();
|
||||
}
|
||||
else if (mProject->mViewInfo.selectedRegion.t0() != mRegion.t0() ||
|
||||
mProject->mViewInfo.selectedRegion.t1() != mRegion.t1())
|
||||
else if (selectedRegion.t0() != mRegion.t0() ||
|
||||
selectedRegion.t1() != mRegion.t1())
|
||||
{
|
||||
mRegion = mProject->mViewInfo.selectedRegion;
|
||||
mRegion = selectedRegion;
|
||||
mPlayPos = mRegion.t0();
|
||||
}
|
||||
|
||||
|
@ -3602,7 +3605,7 @@ void EffectUIHost::OnPlayback(wxCommandEvent & evt)
|
|||
|
||||
if (mPlaying)
|
||||
{
|
||||
mRegion = mProject->mViewInfo.selectedRegion;
|
||||
mRegion = ViewInfo::Get( *mProject ).selectedRegion;
|
||||
mPlayPos = mRegion.t0();
|
||||
}
|
||||
|
||||
|
|
|
@ -100,6 +100,7 @@
|
|||
#include "../Project.h"
|
||||
#include "../TrackArtist.h"
|
||||
#include "../WaveClip.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../widgets/Ruler.h"
|
||||
#include "../xml/XMLFileReader.h"
|
||||
|
|
|
@ -18,6 +18,7 @@
|
|||
|
||||
#include "../Project.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
|
||||
#include "TimeWarper.h"
|
||||
|
@ -78,7 +79,7 @@ bool Generator::Process()
|
|||
tmp->Flush();
|
||||
StepTimeWarper warper{
|
||||
mT0+GetDuration(), GetDuration()-(mT1-mT0) };
|
||||
const auto &selectedRegion = p->GetViewInfo().selectedRegion;
|
||||
const auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
track->ClearAndPaste(
|
||||
selectedRegion.t0(), selectedRegion.t1(),
|
||||
&*tmp, true, false, &warper);
|
||||
|
|
|
@ -63,6 +63,7 @@ effects from this one class.
|
|||
#include "../../Project.h"
|
||||
#include "../../ShuttleGetDefinition.h"
|
||||
#include "../../ShuttleGui.h"
|
||||
#include "../../ViewInfo.h"
|
||||
#include "../../WaveClip.h"
|
||||
#include "../../WaveTrack.h"
|
||||
#include "../../widgets/valnum.h"
|
||||
|
@ -930,7 +931,7 @@ finish:
|
|||
// Selection is to be set to whatever it is in the project.
|
||||
AudacityProject *project = GetActiveProject();
|
||||
if (project) {
|
||||
auto &selectedRegion = project->GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( *project ).selectedRegion;
|
||||
mT0 = selectedRegion.t0();
|
||||
mT1 = selectedRegion.t1();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
#include "../TrackPanel.h"
|
||||
#include "../UndoManager.h"
|
||||
#include "../WaveClip.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
|
@ -372,7 +373,7 @@ wxString ClipBoundaryMessage(const std::vector<FoundClipBoundary>& results)
|
|||
|
||||
void DoSelectClipBoundary(AudacityProject &project, bool next)
|
||||
{
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
std::vector<FoundClipBoundary> results;
|
||||
|
@ -557,7 +558,7 @@ int FindClips
|
|||
|
||||
void DoSelectClip(AudacityProject &project, bool next)
|
||||
{
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
std::vector<FoundClip> results;
|
||||
|
@ -604,7 +605,7 @@ void DoSelectClip(AudacityProject &project, bool next)
|
|||
void DoCursorClipBoundary
|
||||
(AudacityProject &project, bool next)
|
||||
{
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
std::vector<FoundClipBoundary> results;
|
||||
|
@ -698,7 +699,7 @@ void DoClipLeftOrRight
|
|||
}
|
||||
|
||||
auto &panel = *project.GetTrackPanel();
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto &selectedRegion = viewInfo.selectedRegion;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto isSyncLocked = project.IsSyncLocked();
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "../TimeTrack.h"
|
||||
#include "../TrackPanel.h"
|
||||
#include "../UndoManager.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
|
@ -35,7 +36,7 @@ bool DoPasteText(AudacityProject &project)
|
|||
{
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
for (auto pLabelTrack : tracks.Any<LabelTrack>())
|
||||
{
|
||||
|
@ -71,7 +72,7 @@ bool DoPasteNothingSelected(AudacityProject &project)
|
|||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
// First check whether anything's selected.
|
||||
if (tracks.Selected())
|
||||
|
@ -283,7 +284,7 @@ void OnCut(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto ruler = project.GetRulerPanel();
|
||||
|
||||
// This doesn't handle cutting labels, it handles
|
||||
|
@ -368,7 +369,7 @@ void OnDelete(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
for (auto n : tracks.Any()) {
|
||||
if (n->GetSelected() || n->IsSyncLockSelected()) {
|
||||
|
@ -394,7 +395,7 @@ void OnCopy(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
for (auto lt : tracks.Selected< LabelTrack >()) {
|
||||
if (lt->CopySelectedText()) {
|
||||
|
@ -429,7 +430,7 @@ void OnPaste(const CommandContext &context)
|
|||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto isSyncLocked = project.IsSyncLocked();
|
||||
|
||||
// Handle text paste (into active label) first.
|
||||
|
@ -690,7 +691,7 @@ void OnDuplicate(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
// This iteration is unusual because we add to the list inside the loop
|
||||
auto range = tracks.Selected();
|
||||
|
@ -717,7 +718,7 @@ void OnSplitCut(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
auto &clipboard = Clipboard::Get();
|
||||
clipboard.Clear();
|
||||
|
@ -758,7 +759,7 @@ void OnSplitDelete(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
tracks.Selected().Visit(
|
||||
[&](WaveTrack *wt) {
|
||||
|
@ -785,7 +786,7 @@ void OnSilence(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
for ( auto n : tracks.Selected< AudioTrack >() )
|
||||
n->Silence(selectedRegion.t0(), selectedRegion.t1());
|
||||
|
@ -803,7 +804,7 @@ void OnTrim(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if (selectedRegion.isPoint())
|
||||
return;
|
||||
|
@ -836,7 +837,7 @@ void OnSplit(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
double sel0 = selectedRegion.t0();
|
||||
double sel1 = selectedRegion.t1();
|
||||
|
@ -901,7 +902,7 @@ void OnSplitNew(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
Track::Holder dest;
|
||||
|
||||
|
@ -952,7 +953,7 @@ void OnJoin(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
for (auto wt : tracks.Selected< WaveTrack >())
|
||||
wt->Join(selectedRegion.t0(),
|
||||
|
@ -971,7 +972,7 @@ void OnDisjoin(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
for (auto wt : tracks.Selected< WaveTrack >())
|
||||
wt->Disjoin(selectedRegion.t0(),
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "../Prefs.h"
|
||||
#include "../Printing.h"
|
||||
#include "../Project.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
|
@ -229,7 +230,7 @@ void OnExportAudio(const CommandContext &context)
|
|||
void OnExportSelection(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
Exporter e;
|
||||
|
||||
MissingAliasFilesDialog::SetShouldShow(true);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "../Prefs.h"
|
||||
#include "../Project.h"
|
||||
#include "../TrackPanel.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
|
@ -257,7 +258,7 @@ void OnEditLabels(const CommandContext &context)
|
|||
void OnAddLabel(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
DoAddLabel(project, selectedRegion);
|
||||
}
|
||||
|
@ -282,7 +283,7 @@ void OnPasteNewLabel(const CommandContext &context)
|
|||
auto &tracks = TrackList::Get( project );
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
bool bPastedSomething = false;
|
||||
|
||||
|
@ -354,7 +355,7 @@ void OnCutLabels(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
return;
|
||||
|
@ -386,7 +387,7 @@ void OnDeleteLabels(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
return;
|
||||
|
@ -408,7 +409,7 @@ void OnSplitCutLabels(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
return;
|
||||
|
@ -430,7 +431,7 @@ void OnSplitDeleteLabels(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
return;
|
||||
|
@ -453,7 +454,7 @@ void OnSilenceLabels(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
return;
|
||||
|
@ -474,7 +475,7 @@ void OnCopyLabels(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
return;
|
||||
|
@ -493,7 +494,7 @@ void OnSplitLabels(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
EditByLabel( tracks, selectedRegion, &WaveTrack::Split, false );
|
||||
|
||||
|
@ -511,7 +512,7 @@ void OnJoinLabels(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
return;
|
||||
|
@ -532,7 +533,7 @@ void OnDisjoinLabels(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if( selectedRegion.isPoint() )
|
||||
return;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "../Project.h"
|
||||
#include "../Screenshot.h"
|
||||
#include "../TrackPanel.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
|
@ -397,7 +398,7 @@ bool DoEffect(
|
|||
auto trackPanel = project.GetTrackPanel();
|
||||
auto trackFactory = project.GetTrackFactory();
|
||||
auto rate = project.GetRate();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto commandManager = project.GetCommandManager();
|
||||
|
||||
const PluginDescriptor *plug = PluginManager::Get().GetPlugin(ID);
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "../Project.h"
|
||||
#include "../TimeDialog.h"
|
||||
#include "../TrackPanel.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../NoteTrack.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
|
@ -24,7 +25,7 @@ void DoSelectTimeAndTracks
|
|||
{
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if( bAllTime )
|
||||
selectedRegion.setTimes(
|
||||
|
@ -46,7 +47,7 @@ void DoSelectTimeAndAudioTracks
|
|||
{
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
if( bAllTime )
|
||||
selectedRegion.setTimes(
|
||||
|
@ -67,7 +68,7 @@ void DoSelectTimeAndAudioTracks
|
|||
void DoNextPeakFrequency(AudacityProject &project, bool up)
|
||||
{
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
// Find the first selected wave track that is in a spectrogram view.
|
||||
|
@ -225,7 +226,7 @@ double GridMove
|
|||
(AudacityProject &project, double t, int minPix)
|
||||
{
|
||||
auto rate = project.GetRate();
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto format = project.GetSelectionFormat();
|
||||
|
||||
NumericConverter nc(NumericConverter::TIME, format, t, rate);
|
||||
|
@ -250,7 +251,7 @@ double OffsetTime
|
|||
(AudacityProject &project,
|
||||
double t, double offset, TimeUnit timeUnit, int snapToTime)
|
||||
{
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
if (timeUnit == TIME_UNIT_SECONDS)
|
||||
return t + offset; // snapping is currently ignored for non-pixel moves
|
||||
|
@ -265,7 +266,7 @@ double OffsetTime
|
|||
void MoveWhenAudioInactive
|
||||
(AudacityProject &project, double seekStep, TimeUnit timeUnit)
|
||||
{
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto ruler = project.GetRulerPanel();
|
||||
|
@ -318,7 +319,7 @@ void SeekWhenAudioInactive
|
|||
(AudacityProject &project, double seekStep, TimeUnit timeUnit,
|
||||
SelectionOperation operation)
|
||||
{
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
|
@ -416,7 +417,7 @@ void DoCursorMove(
|
|||
|
||||
void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
|
||||
{
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
|
@ -496,9 +497,10 @@ void SelectNone( AudacityProject &project )
|
|||
// time range is selected.
|
||||
void SelectAllIfNone( AudacityProject &project )
|
||||
{
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto flags = GetMenuManager( project ).GetUpdateFlags( project );
|
||||
if(!(flags & TracksSelectedFlag) ||
|
||||
(project.GetViewInfo().selectedRegion.isPoint()))
|
||||
viewInfo.selectedRegion.isPoint())
|
||||
DoSelectAllAudio( project );
|
||||
}
|
||||
|
||||
|
@ -508,7 +510,7 @@ void DoListSelection
|
|||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectionState = project.GetSelectionState();
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto isSyncLocked = project.IsSyncLocked();
|
||||
|
||||
selectionState.HandleListSelection(
|
||||
|
@ -540,7 +542,7 @@ void DoSelectAllAudio(AudacityProject &project)
|
|||
void DoSelectSomething(AudacityProject &project)
|
||||
{
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
bool bTime = selectedRegion.isPoint();
|
||||
bool bTracks = tracks.Selected().empty();
|
||||
|
@ -565,7 +567,7 @@ void OnSelectAll(const CommandContext &context)
|
|||
void OnSelectNone(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
selectedRegion.collapseToT0();
|
||||
SelectNone( project );
|
||||
|
@ -604,7 +606,7 @@ void OnSetLeftSelection(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto token = project.GetAudioIOToken();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
bool bSelChanged = false;
|
||||
|
@ -642,7 +644,7 @@ void OnSetRightSelection(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto token = project.GetAudioIOToken();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
bool bSelChanged = false;
|
||||
|
@ -681,7 +683,7 @@ void OnSelectStartCursor(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
double kWayOverToRight = std::numeric_limits<double>::max();
|
||||
|
||||
|
@ -707,7 +709,7 @@ void OnSelectCursorEnd(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
double kWayOverToLeft = std::numeric_limits<double>::lowest();
|
||||
|
||||
|
@ -731,7 +733,7 @@ void OnSelectCursorEnd(const CommandContext &context)
|
|||
void OnSelectTrackStartToEnd(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
|
@ -754,7 +756,7 @@ SelectedRegion mRegionSave{};
|
|||
void OnSelectionSave(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
mRegionSave = selectedRegion;
|
||||
}
|
||||
|
@ -762,7 +764,7 @@ void OnSelectionSave(const CommandContext &context)
|
|||
void OnSelectionRestore(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
if ((mRegionSave.t0() == 0.0) &&
|
||||
|
@ -786,7 +788,7 @@ void OnToggleSpectralSelection(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
const double f0 = selectedRegion.f0();
|
||||
const double f1 = selectedRegion.f1();
|
||||
|
@ -828,7 +830,7 @@ void OnSelectCursorStoredCursor(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto isAudioActive = project.IsAudioActive();
|
||||
|
||||
if (mCursorPositionHasBeenStored) {
|
||||
|
@ -847,7 +849,7 @@ void OnSelectCursorStoredCursor(const CommandContext &context)
|
|||
void OnCursorPositionStore(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto isAudioActive = project.IsAudioActive();
|
||||
|
||||
mCursorPositionStored =
|
||||
|
@ -858,7 +860,7 @@ void OnCursorPositionStore(const CommandContext &context)
|
|||
void OnZeroCrossing(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
const double t0 = NearestZeroCrossing(project, selectedRegion.t0());
|
||||
|
@ -953,7 +955,7 @@ void OnCursorSelStart(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
selectedRegion.collapseToT0();
|
||||
project.ModifyState(false);
|
||||
|
@ -965,7 +967,7 @@ void OnCursorSelEnd(const CommandContext &context)
|
|||
{
|
||||
auto &project = context.project;
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
selectedRegion.collapseToT1();
|
||||
project.ModifyState(false);
|
||||
|
@ -978,7 +980,7 @@ void OnCursorTrackStart(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
double kWayOverToRight = std::numeric_limits<double>::max();
|
||||
|
||||
|
@ -1005,7 +1007,7 @@ void OnCursorTrackEnd(const CommandContext &context)
|
|||
auto &project = context.project;
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
double kWayOverToLeft = std::numeric_limits<double>::lowest();
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "../TrackPanel.h"
|
||||
#include "../UndoManager.h"
|
||||
#include "../WaveClip.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
|
@ -154,7 +155,7 @@ void DoAlign
|
|||
(AudacityProject &project, int index, bool moveSel)
|
||||
{
|
||||
auto &tracks = TrackList::Get( project );
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
wxString action;
|
||||
wxString shortAction;
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "../UndoManager.h"
|
||||
#include "../WaveClip.h"
|
||||
#include "../prefs/RecordingPrefs.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../prefs/TracksPrefs.h"
|
||||
#include "../toolbars/ControlToolBar.h"
|
||||
#include "../toolbars/TranscriptionToolBar.h"
|
||||
|
@ -154,7 +155,7 @@ void DoMoveToLabel(AudacityProject &project, bool next)
|
|||
|
||||
// If there is a single label track, or there is a label track at or below
|
||||
// the focused track
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
if (lt) {
|
||||
int i;
|
||||
if (next)
|
||||
|
@ -207,7 +208,7 @@ bool DoPlayStopSelect
|
|||
auto toolbar = project.GetControlToolBar();
|
||||
auto &scrubber = project.GetScrubber();
|
||||
auto token = project.GetAudioIOToken();
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto &selection = viewInfo.selectedRegion;
|
||||
|
||||
//If busy, stop playing, make sure everything is unpaused.
|
||||
|
@ -493,7 +494,7 @@ void OnTimerRecord(const CommandContext &context)
|
|||
void OnPunchAndRoll(const CommandContext &context)
|
||||
{
|
||||
AudacityProject &project = context.project;
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
|
||||
static const auto url =
|
||||
wxT("Punch_and_Roll_Record#Using_Punch_and_Roll_Record");
|
||||
|
@ -728,7 +729,7 @@ void OnPlayToSelection(const CommandContext &context)
|
|||
return;
|
||||
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
|
||||
double pos = trackPanel->GetMostRecentXPos();
|
||||
|
@ -774,7 +775,7 @@ void OnPlayBeforeSelectionStart(const CommandContext &context)
|
|||
if( !MakeReadyToPlay(project) )
|
||||
return;
|
||||
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
|
||||
double t0 = selectedRegion.t0();
|
||||
|
@ -795,7 +796,7 @@ void OnPlayAfterSelectionStart(const CommandContext &context)
|
|||
if( !MakeReadyToPlay(project) )
|
||||
return;
|
||||
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
|
||||
double t0 = selectedRegion.t0();
|
||||
|
@ -822,7 +823,7 @@ void OnPlayBeforeSelectionEnd(const CommandContext &context)
|
|||
if( !MakeReadyToPlay(project) )
|
||||
return;
|
||||
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
|
||||
double t0 = selectedRegion.t0();
|
||||
|
@ -850,7 +851,7 @@ void OnPlayAfterSelectionEnd(const CommandContext &context)
|
|||
if( !MakeReadyToPlay(project) )
|
||||
return;
|
||||
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
|
||||
double t1 = selectedRegion.t1();
|
||||
|
@ -872,7 +873,7 @@ void OnPlayBeforeAndAfterSelectionStart
|
|||
if (!MakeReadyToPlay(project))
|
||||
return;
|
||||
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
|
||||
double t0 = selectedRegion.t0();
|
||||
|
@ -903,7 +904,7 @@ void OnPlayBeforeAndAfterSelectionEnd
|
|||
if (!MakeReadyToPlay(project))
|
||||
return;
|
||||
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &selectedRegion = viewInfo.selectedRegion;
|
||||
|
||||
double t0 = selectedRegion.t0();
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "../Prefs.h"
|
||||
#include "../Project.h"
|
||||
#include "../TrackPanel.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../commands/CommandContext.h"
|
||||
#include "../commands/CommandManager.h"
|
||||
#include "../prefs/GUIPrefs.h"
|
||||
|
@ -24,7 +25,7 @@ namespace {
|
|||
|
||||
double GetZoomOfSelection( const AudacityProject &project )
|
||||
{
|
||||
const auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &trackPanel = *project.GetTrackPanel();
|
||||
|
||||
const double lowerBound =
|
||||
|
@ -122,7 +123,7 @@ namespace ViewActions {
|
|||
double GetZoomOfToFit( const AudacityProject &project )
|
||||
{
|
||||
auto &tracks = TrackList::Get( project );
|
||||
const auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
const auto &trackPanel = *project.GetTrackPanel();
|
||||
|
||||
const double end = tracks.GetEndTime();
|
||||
|
@ -142,7 +143,7 @@ double GetZoomOfToFit( const AudacityProject &project )
|
|||
|
||||
void DoZoomFit(AudacityProject &project)
|
||||
{
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto &tracks = TrackList::Get( project );
|
||||
|
||||
const double start = viewInfo.bScrollBeyondZero
|
||||
|
@ -209,7 +210,7 @@ void OnZoomOut(const CommandContext &context)
|
|||
void OnZoomSel(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &selectedRegion = project.GetViewInfo().selectedRegion;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
|
||||
project.Zoom( GetZoomOfSelection( project ) );
|
||||
project.TP_ScrollWindow(selectedRegion.t0());
|
||||
|
@ -218,7 +219,7 @@ void OnZoomSel(const CommandContext &context)
|
|||
void OnZoomToggle(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto trackPanel = project.GetTrackPanel();
|
||||
|
||||
// const double origLeft = viewInfo.h;
|
||||
|
@ -293,7 +294,7 @@ void OnExpandAllTracks(const CommandContext &context)
|
|||
void OnGoSelStart(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto &selectedRegion = viewInfo.selectedRegion;
|
||||
auto &trackPanel = *project.GetTrackPanel();
|
||||
|
||||
|
@ -307,7 +308,7 @@ void OnGoSelStart(const CommandContext &context)
|
|||
void OnGoSelEnd(const CommandContext &context)
|
||||
{
|
||||
auto &project = context.project;
|
||||
auto &viewInfo = project.GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( project );
|
||||
auto &selectedRegion = viewInfo.selectedRegion;
|
||||
auto &trackPanel = *project.GetTrackPanel();
|
||||
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include "../Menus.h"
|
||||
#include "../Prefs.h"
|
||||
#include "../Project.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../widgets/AButton.h"
|
||||
#include "../widgets/Meter.h"
|
||||
#include "../widgets/LinkingHtmlWindow.h"
|
||||
|
@ -617,7 +618,7 @@ int ControlToolBar::PlayPlayRegion(const SelectedRegion &selectedRegion,
|
|||
|
||||
if (t1 == t0) {
|
||||
if (looped) {
|
||||
const auto &selectedRegion = p->GetViewInfo().selectedRegion;
|
||||
const auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
// play selection if there is one, otherwise
|
||||
// set start of play region to project start,
|
||||
// and loop the project from current play position.
|
||||
|
@ -988,7 +989,7 @@ void ControlToolBar::OnRecord(wxCommandEvent &evt)
|
|||
const bool appendRecord = (altAppearance == bPreferNewTrack);
|
||||
|
||||
if (p) {
|
||||
const auto &selectedRegion = p->GetViewInfo().selectedRegion;
|
||||
const auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
double t0 = selectedRegion.t0();
|
||||
double t1 = selectedRegion.t1();
|
||||
// When no time selection, recording duration is 'unlimited'.
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "../KeyboardCapture.h"
|
||||
#include "../Project.h"
|
||||
#include "../TimeTrack.h"
|
||||
#include "../ViewInfo.h"
|
||||
#include "../WaveTrack.h"
|
||||
#include "../widgets/AButton.h"
|
||||
#include "../widgets/ASlider.h"
|
||||
|
@ -403,7 +404,7 @@ void TranscriptionToolBar::GetSamples(
|
|||
//First, get the current selection. It is part of the mViewInfo, which is
|
||||
//part of the project
|
||||
|
||||
const auto &selectedRegion = p->GetViewInfo().selectedRegion;
|
||||
const auto &selectedRegion = ViewInfo::Get( *p ).selectedRegion;
|
||||
double start = selectedRegion.t0();
|
||||
double end = selectedRegion.t1();
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../../RefreshCode.h"
|
||||
#include "../../../TrackPanelMouseEvent.h"
|
||||
#include "../../../UndoManager.h"
|
||||
#include "../../../ViewInfo.h"
|
||||
|
||||
#include <wx/cursor.h>
|
||||
#include <wx/translation.h>
|
||||
|
@ -86,7 +87,7 @@ UIHandle::Result LabelGlyphHandle::Click
|
|||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
mpLT->HandleGlyphClick
|
||||
(mHit, event, mRect, viewInfo, &viewInfo.selectedRegion);
|
||||
|
||||
|
@ -116,7 +117,7 @@ UIHandle::Result LabelGlyphHandle::Drag
|
|||
auto result = LabelDefaultClickHandle::Drag( evt, pProject );
|
||||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
mpLT->HandleGlyphDragRelease
|
||||
(mHit, event, mRect, viewInfo, &viewInfo.selectedRegion);
|
||||
|
||||
|
@ -137,7 +138,7 @@ UIHandle::Result LabelGlyphHandle::Release
|
|||
auto result = LabelDefaultClickHandle::Release( evt, pProject, pParent );
|
||||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
if (mpLT->HandleGlyphDragRelease
|
||||
(mHit, event, mRect, viewInfo, &viewInfo.selectedRegion)) {
|
||||
pProject->PushState(_("Modified Label"),
|
||||
|
|
|
@ -18,6 +18,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../../Project.h"
|
||||
#include "../../../RefreshCode.h"
|
||||
#include "../../../TrackPanelMouseEvent.h"
|
||||
#include "../../../ViewInfo.h"
|
||||
#include "../../../images/Cursors.h"
|
||||
|
||||
LabelTextHandle::LabelTextHandle
|
||||
|
@ -79,7 +80,7 @@ UIHandle::Result LabelTextHandle::Click
|
|||
std::make_shared< SelectionStateChanger >( selectionState, tracks );
|
||||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
mSelectedRegion = viewInfo.selectedRegion;
|
||||
pLT->HandleTextClick( event, evt.rect, viewInfo, &viewInfo.selectedRegion );
|
||||
|
@ -183,7 +184,7 @@ UIHandle::Result LabelTextHandle::Cancel( AudacityProject *pProject )
|
|||
// Restore the selection states of tracks
|
||||
// Note that we are also relying on LabelDefaultClickHandle::Cancel
|
||||
// to restore the selection state of the labels in the tracks.
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
viewInfo.selectedRegion = mSelectedRegion;
|
||||
auto result = LabelDefaultClickHandle::Cancel( pProject );
|
||||
return result | RefreshCode::RefreshAll;
|
||||
|
|
|
@ -19,6 +19,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../../../RefreshCode.h"
|
||||
#include "../../../../TrackPanelMouseEvent.h"
|
||||
#include "../../../../UndoManager.h"
|
||||
#include "../../../../ViewInfo.h"
|
||||
#include "../../../../../images/Cursors.h"
|
||||
|
||||
#include <algorithm>
|
||||
|
@ -73,7 +74,7 @@ UIHandlePtr StretchHandle::HitTest
|
|||
// later, we may want a different policy, but for now, stretch is
|
||||
// selected when the cursor is near the center of the track and
|
||||
// within the selection
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
if (!pTrack || !pTrack->GetSelected())
|
||||
return {};
|
||||
|
@ -166,7 +167,7 @@ UIHandle::Result StretchHandle::Click
|
|||
|
||||
|
||||
mLeftEdge = evt.rect.GetLeft();
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
viewInfo.selectedRegion.setTimes
|
||||
( mStretchState.mBeat0.first, mStretchState.mBeat1.first );
|
||||
|
@ -223,7 +224,7 @@ UIHandle::Result StretchHandle::Release
|
|||
|
||||
bool left = mStretchState.mMode == stretchLeft;
|
||||
bool right = mStretchState.mMode == stretchRight;
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
if ( pProject->IsSyncLocked() && ( left || right ) ) {
|
||||
for ( auto track :
|
||||
TrackList::SyncLockGroup( mpTrack.get() ) ) {
|
||||
|
@ -277,7 +278,7 @@ double StretchHandle::GetT1(const Track &track, const ViewInfo &viewInfo)
|
|||
void StretchHandle::Stretch(AudacityProject *pProject, int mouseXCoordinate, int trackLeftEdge,
|
||||
Track *pTrack)
|
||||
{
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
if (pTrack == NULL && mpTrack != NULL)
|
||||
pTrack = mpTrack.get();
|
||||
|
|
|
@ -19,6 +19,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../../../Snap.h" // for kPixelTolerance
|
||||
#include "../../../../TrackPanelMouseEvent.h"
|
||||
#include "../../../../UndoManager.h"
|
||||
#include "../../../../ViewInfo.h"
|
||||
#include "../../../../WaveTrack.h"
|
||||
#include "../../../../../images/Cursors.h"
|
||||
|
||||
|
@ -99,7 +100,7 @@ UIHandlePtr CutlineHandle::HitTest
|
|||
const AudacityProject *pProject,
|
||||
const std::shared_ptr<WaveTrack> &pTrack)
|
||||
{
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
/// method that tells us if the mouse event landed on an
|
||||
/// editable Cutline
|
||||
|
||||
|
@ -125,7 +126,7 @@ UIHandle::Result CutlineHandle::Click
|
|||
return Cancelled;
|
||||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
// Can affect the track by merging clips, expanding a cutline, or
|
||||
// deleting a cutline.
|
||||
|
@ -244,8 +245,8 @@ UIHandle::Result CutlineHandle::Cancel(AudacityProject *pProject)
|
|||
UIHandle::Result result = RefreshCell;
|
||||
pProject->RollbackState();
|
||||
if (mOperation == Expand) {
|
||||
AudacityProject *const project = pProject;
|
||||
auto &selectedRegion = project->GetViewInfo().selectedRegion;
|
||||
AudacityProject &project = *pProject;
|
||||
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
|
||||
selectedRegion.setTimes( mStartTime, mEndTime );
|
||||
result |= UpdateSelection;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../../../TrackArtist.h"
|
||||
#include "../../../../TrackPanelMouseEvent.h"
|
||||
#include "../../../../UndoManager.h"
|
||||
#include "../../../../ViewInfo.h"
|
||||
#include "../../../../WaveTrack.h"
|
||||
#include "../../../../../images/Cursors.h"
|
||||
#include "../../../../widgets/AudacityMessageBox.h"
|
||||
|
@ -112,7 +113,7 @@ UIHandlePtr SampleHandle::HitTest
|
|||
const wxMouseState &state, const wxRect &rect,
|
||||
const AudacityProject *pProject, const std::shared_ptr<WaveTrack> &pTrack)
|
||||
{
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
const auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
/// method that tells us if the mouse event landed on an
|
||||
/// editable sample
|
||||
|
@ -210,7 +211,7 @@ UIHandle::Result SampleHandle::Click
|
|||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
const wxRect &rect = evt.rect;
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
const auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
const auto pTrack = mClickedTrack.get();
|
||||
|
||||
/// Someone has just clicked the mouse. What do we do?
|
||||
|
@ -334,7 +335,7 @@ UIHandle::Result SampleHandle::Drag
|
|||
{
|
||||
using namespace RefreshCode;
|
||||
const wxMouseEvent &event = evt.event;
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
const auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
const bool unsafe = pProject->IsAudioActive();
|
||||
if (unsafe) {
|
||||
|
|
|
@ -20,6 +20,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../Track.h"
|
||||
#include "../../TrackPanel.h"
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
#include "../../ViewInfo.h"
|
||||
|
||||
CommonTrackPanelCell::~CommonTrackPanelCell()
|
||||
{
|
||||
|
@ -45,7 +46,7 @@ unsigned CommonTrackPanelCell::HandleWheelRotation
|
|||
|
||||
unsigned result = RefreshAll;
|
||||
const wxMouseEvent &event = evt.event;
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
Scrubber &scrubber = pProject->GetScrubber();
|
||||
const auto steps = evt.steps;
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../Track.h" //
|
||||
#include "../../TrackPanelAx.h"
|
||||
#include "../../TrackPanel.h"
|
||||
#include "../../ViewInfo.h"
|
||||
|
||||
#include <wx/dc.h>
|
||||
|
||||
|
@ -44,15 +45,15 @@ unsigned EditCursorOverlay::SequenceNumber() const
|
|||
|
||||
std::pair<wxRect, bool> EditCursorOverlay::DoGetRectangle(wxSize size)
|
||||
{
|
||||
const auto &selection = mProject->GetViewInfo().selectedRegion;
|
||||
const auto &selection = ViewInfo::Get( *mProject ).selectedRegion;
|
||||
if (!selection.isPoint()) {
|
||||
mCursorTime = -1.0;
|
||||
mNewCursorX = -1;
|
||||
}
|
||||
else {
|
||||
mCursorTime = selection.t0();
|
||||
mNewCursorX = mProject->GetZoomInfo().TimeToPosition
|
||||
(mCursorTime, mProject->GetTrackPanel()->GetLeftOffset());
|
||||
mNewCursorX = ZoomInfo::Get( *mProject ).TimeToPosition(
|
||||
mCursorTime, mProject->GetTrackPanel()->GetLeftOffset());
|
||||
}
|
||||
|
||||
// Excessive height in case of the ruler, but it matters little.
|
||||
|
@ -79,7 +80,7 @@ void EditCursorOverlay::Draw(OverlayPanel &panel, wxDC &dc)
|
|||
if (mLastCursorX == -1)
|
||||
return;
|
||||
|
||||
const ZoomInfo &viewInfo = mProject->GetZoomInfo();
|
||||
const auto &viewInfo = ZoomInfo::Get( *mProject );
|
||||
|
||||
const bool
|
||||
onScreen = between_incexc(viewInfo.h,
|
||||
|
|
|
@ -21,6 +21,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../TimeTrack.h"
|
||||
#include "../../TrackArtist.h"
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
#include "../../ViewInfo.h"
|
||||
#include "../../WaveTrack.h"
|
||||
#include "../../../images/Cursors.h"
|
||||
|
||||
|
@ -52,7 +53,7 @@ namespace {
|
|||
(const AudacityProject &project, const TimeTrack &tt,
|
||||
double &dBRange, bool &dB, float &zoomMin, float &zoomMax)
|
||||
{
|
||||
const auto &viewInfo = project.GetViewInfo();
|
||||
const auto &viewInfo = ViewInfo::Get( project );
|
||||
dBRange = viewInfo.dBr;
|
||||
dB = tt.GetDisplayLog();
|
||||
zoomMin = tt.GetRangeLower(), zoomMax = tt.GetRangeUpper();
|
||||
|
@ -117,7 +118,7 @@ UIHandlePtr EnvelopeHandle::HitEnvelope
|
|||
Envelope *envelope, float zoomMin, float zoomMax,
|
||||
bool dB, float dBRange, bool timeTrack)
|
||||
{
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
const auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
const double envValue =
|
||||
envelope->GetValue(viewInfo.PositionToTime(state.m_x, rect.x));
|
||||
|
@ -173,7 +174,7 @@ UIHandle::Result EnvelopeHandle::Click
|
|||
return Cancelled;
|
||||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
const auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
const auto pTrack = static_cast<Track*>(evt.pCell.get());
|
||||
|
||||
mEnvelopeEditors.clear();
|
||||
|
@ -239,7 +240,7 @@ UIHandle::Result EnvelopeHandle::Drag
|
|||
{
|
||||
using namespace RefreshCode;
|
||||
const wxMouseEvent &event = evt.event;
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
const auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
const bool unsafe = pProject->IsAudioActive();
|
||||
if (unsafe) {
|
||||
this->Cancel(pProject);
|
||||
|
@ -278,7 +279,7 @@ UIHandle::Result EnvelopeHandle::Release
|
|||
wxWindow *)
|
||||
{
|
||||
const wxMouseEvent &event = evt.event;
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
const auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
const bool unsafe = pProject->IsAudioActive();
|
||||
if (unsafe)
|
||||
return this->Cancel(pProject);
|
||||
|
|
|
@ -17,6 +17,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../Project.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackPanel.h"
|
||||
#include "../../ViewInfo.h"
|
||||
#include "Scrubbing.h"
|
||||
#include "../../toolbars/ControlToolBar.h"
|
||||
|
||||
|
@ -153,7 +154,7 @@ void PlayIndicatorOverlay::OnTimer(wxCommandEvent &event)
|
|||
}
|
||||
}
|
||||
else {
|
||||
ViewInfo &viewInfo = mProject->GetViewInfo();
|
||||
const auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
|
||||
// Calculate the horizontal position of the indicator
|
||||
const double playPos = viewInfo.mRecentStreamTime;
|
||||
|
|
|
@ -20,6 +20,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../Menus.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../TrackPanel.h"
|
||||
#include "../../ViewInfo.h"
|
||||
#include "../../prefs/PlaybackPrefs.h"
|
||||
#include "../../prefs/TracksPrefs.h"
|
||||
#include "../../toolbars/ControlToolBar.h"
|
||||
|
@ -333,7 +334,7 @@ bool Scrubber::MaybeStartScrubbing(wxCoord xx)
|
|||
|
||||
wxCoord position = xx;
|
||||
if (abs(mScrubStartPosition - position) >= SCRUBBING_PIXEL_TOLERANCE) {
|
||||
const ViewInfo &viewInfo = mProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
TrackPanel *const trackPanel = mProject->GetTrackPanel();
|
||||
ControlToolBar * const ctb = mProject->GetControlToolBar();
|
||||
double maxTime = TrackList::Get( *mProject ).GetEndTime();
|
||||
|
@ -548,7 +549,7 @@ void Scrubber::ContinueScrubbingPoll()
|
|||
const wxMouseState state(::wxGetMouseState());
|
||||
const auto trackPanel = mProject->GetTrackPanel();
|
||||
const wxPoint position = trackPanel->ScreenToClient(state.GetPosition());
|
||||
const auto &viewInfo = mProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
#ifdef DRAG_SCRUB
|
||||
if (mDragging && mSmoothScrollingScrub) {
|
||||
const auto lastTime = gAudioIO->GetLastScrubTime();
|
||||
|
@ -779,7 +780,7 @@ bool Scrubber::ShouldDrawScrubSpeed()
|
|||
|
||||
double Scrubber::FindScrubSpeed(bool seeking, double time) const
|
||||
{
|
||||
ViewInfo &viewInfo = mProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *mProject );
|
||||
const double screen =
|
||||
mProject->GetTrackPanel()->GetScreenEndTime() - viewInfo.h;
|
||||
return (seeking ? FindSeekSpeed : FindScrubbingSpeed)
|
||||
|
@ -970,8 +971,9 @@ void ScrubbingOverlay::OnTimer(wxCommandEvent &event)
|
|||
const double maxScrubSpeed = GetScrubber().GetMaxScrubSpeed();
|
||||
const double speed =
|
||||
scrubber.IsScrollScrubbing()
|
||||
? scrubber.FindScrubSpeed
|
||||
(seeking, mProject->GetViewInfo().PositionToTime(position.x, trackPanel->GetLeftOffset()))
|
||||
? scrubber.FindScrubSpeed( seeking,
|
||||
ViewInfo::Get( *mProject )
|
||||
.PositionToTime(position.x, trackPanel->GetLeftOffset()))
|
||||
: maxScrubSpeed;
|
||||
|
||||
const wxChar *format =
|
||||
|
|
|
@ -24,6 +24,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../RefreshCode.h"
|
||||
#include "../../TrackPanel.h"
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
#include "../../ViewInfo.h"
|
||||
#include "../../WaveClip.h"
|
||||
#include "../../WaveTrack.h"
|
||||
#include "../../ondemand/ODManager.h"
|
||||
|
@ -383,7 +384,7 @@ UIHandlePtr SelectHandle::HitTest
|
|||
oldUseSnap = old->mUseSnap;
|
||||
}
|
||||
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
const auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
auto result = std::make_shared<SelectHandle>(
|
||||
pTrack, oldUseSnap, TrackList::Get( *pProject ), st, viewInfo );
|
||||
|
||||
|
@ -489,7 +490,7 @@ void SelectHandle::SetUseSnap(bool use)
|
|||
if (IsClicked()) {
|
||||
// Readjust the moving selection end
|
||||
AssignSelection(
|
||||
::GetActiveProject()->GetViewInfo(),
|
||||
ViewInfo::Get( *::GetActiveProject() ),
|
||||
mUseSnap ? mSnapEnd.outTime : mSnapEnd.timeSnappedTime,
|
||||
nullptr);
|
||||
mChangeHighlight |= RefreshCode::UpdateSelection;
|
||||
|
@ -527,7 +528,7 @@ UIHandle::Result SelectHandle::Click
|
|||
wxMouseEvent &event = evt.event;
|
||||
const auto sTrack = TrackList::Get( *pProject ).Lock(mpTrack);
|
||||
const auto pTrack = sTrack.get();
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
mMostRecentX = event.m_x;
|
||||
mMostRecentY = event.m_y;
|
||||
|
@ -784,7 +785,7 @@ UIHandle::Result SelectHandle::Drag
|
|||
{
|
||||
using namespace RefreshCode;
|
||||
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
const wxMouseEvent &event = evt.event;
|
||||
|
||||
int x = mAutoScrolling ? mMostRecentX : event.m_x;
|
||||
|
@ -891,7 +892,7 @@ HitTestPreview SelectHandle::Preview
|
|||
else {
|
||||
// Choose one of many cursors for mouse-over
|
||||
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
auto &state = st.state;
|
||||
auto time = mUseSnap ? mSnapStart.outTime : mSnapStart.timeSnappedTime;
|
||||
|
@ -998,7 +999,7 @@ UIHandle::Result SelectHandle::Release
|
|||
UIHandle::Result SelectHandle::Cancel(AudacityProject *pProject)
|
||||
{
|
||||
mSelectionStateChanger.reset();
|
||||
pProject->GetViewInfo().selectedRegion = mInitialSelection;
|
||||
ViewInfo::Get( *pProject ).selectedRegion = mInitialSelection;
|
||||
|
||||
return RefreshCode::RefreshAll;
|
||||
}
|
||||
|
@ -1112,7 +1113,7 @@ void SelectHandle::TimerHandler::OnTimer(wxCommandEvent &event)
|
|||
/// Reset our selection markers.
|
||||
void SelectHandle::StartSelection( AudacityProject *pProject )
|
||||
{
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
mSelStartValid = true;
|
||||
|
||||
viewInfo.selectedRegion.setTimes(mSelStart, mSelStart);
|
||||
|
|
|
@ -23,6 +23,7 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../toolbars/ToolsToolBar.h"
|
||||
#include "../../UndoManager.h"
|
||||
#include "../../WaveClip.h"
|
||||
#include "../../ViewInfo.h"
|
||||
#include "../../WaveTrack.h"
|
||||
#include "../../../images/Cursors.h"
|
||||
|
||||
|
@ -358,7 +359,7 @@ UIHandle::Result TimeShiftHandle::Click
|
|||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
const wxRect &rect = evt.rect;
|
||||
const ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
const auto pTrack = std::static_pointer_cast<Track>(evt.pCell);
|
||||
if (!pTrack)
|
||||
|
@ -677,7 +678,7 @@ UIHandle::Result TimeShiftHandle::Drag
|
|||
}
|
||||
|
||||
const wxMouseEvent &event = evt.event;
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
|
||||
Track *track = dynamic_cast<Track*>(evt.pCell.get());
|
||||
|
||||
|
|
|
@ -16,13 +16,13 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include "../../RefreshCode.h"
|
||||
#include "../../Menus.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../TrackPanel.h" // for TrackInfo
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
#include <wx/textdlg.h>
|
||||
#include "../../commands/CommandType.h"
|
||||
#include "../../commands/CommandManager.h"
|
||||
#include "../../ShuttleGui.h"
|
||||
#include "../../Track.h"
|
||||
#include "../../widgets/PopupMenuTable.h"
|
||||
|
||||
|
||||
|
|
|
@ -18,9 +18,9 @@ Paul Licameli split from TrackPanel.cpp
|
|||
#include <wx/gdicmn.h>
|
||||
|
||||
#include "../../HitTestResult.h"
|
||||
#include "../../Project.h"
|
||||
#include "../../RefreshCode.h"
|
||||
#include "../../TrackPanelMouseEvent.h"
|
||||
#include "../../ViewInfo.h"
|
||||
#include "../../../images/Cursors.h"
|
||||
|
||||
/// This class takes care of our different zoom
|
||||
|
@ -126,7 +126,7 @@ UIHandle::Result ZoomHandle::Release
|
|||
wxWindow *)
|
||||
{
|
||||
const wxMouseEvent &event = evt.event;
|
||||
ViewInfo &viewInfo = pProject->GetViewInfo();
|
||||
auto &viewInfo = ViewInfo::Get( *pProject );
|
||||
if (mZoomEnd < mZoomStart)
|
||||
std::swap(mZoomStart, mZoomEnd);
|
||||
|
||||
|
|
Loading…
Reference in New Issue