mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
Bug 63 - Analysis effects that create labels should give focus to label Track
If a generator, effect or analyser has created a new track, scroll to the bottom of the track list. Acheived using new function, VerticalScroll()
This commit is contained in:
parent
4d978bcefb
commit
2108515938
@ -4298,6 +4298,7 @@ bool AudacityProject::OnEffect(const PluginID & ID, int flags)
|
|||||||
|
|
||||||
wxGetApp().SetMissingAliasedFileWarningShouldShow(true);
|
wxGetApp().SetMissingAliasedFileWarningShouldShow(true);
|
||||||
|
|
||||||
|
int nTracksOriginally = GetTrackCount();
|
||||||
TrackListIterator iter(GetTracks());
|
TrackListIterator iter(GetTracks());
|
||||||
Track *t = iter.First();
|
Track *t = iter.First();
|
||||||
WaveTrack *newTrack{};
|
WaveTrack *newTrack{};
|
||||||
@ -4389,9 +4390,18 @@ bool AudacityProject::OnEffect(const PluginID & ID, int flags)
|
|||||||
if (focus != nullptr) {
|
if (focus != nullptr) {
|
||||||
focus->SetFocus();
|
focus->SetFocus();
|
||||||
}
|
}
|
||||||
mTrackPanel->EnsureVisible(mTrackPanel->GetFirstSelectedTrack());
|
|
||||||
|
|
||||||
|
// A fix for Bug 63
|
||||||
|
// New tracks added? Scroll them into view so that user sees them.
|
||||||
|
// Don't care what track type. An analyser might just have added a
|
||||||
|
// Label track and we want to see it.
|
||||||
|
if( GetTrackCount() > nTracksOriginally ){
|
||||||
|
// 0.0 is min scroll position, 1.0 is max scroll position.
|
||||||
|
GetTrackPanel()->VerticalScroll( 1.0 );
|
||||||
|
} else {
|
||||||
|
mTrackPanel->EnsureVisible(mTrackPanel->GetFirstSelectedTrack());
|
||||||
mTrackPanel->Refresh(false);
|
mTrackPanel->Refresh(false);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -176,6 +176,7 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
|
|||||||
|
|
||||||
TrackList *GetTracks() { return mTracks.get(); }
|
TrackList *GetTracks() { return mTracks.get(); }
|
||||||
const TrackList *GetTracks() const { return mTracks.get(); }
|
const TrackList *GetTracks() const { return mTracks.get(); }
|
||||||
|
const int GetTrackCount(){ return GetTracks()->GetCount(); }
|
||||||
UndoManager *GetUndoManager() { return mUndoManager.get(); }
|
UndoManager *GetUndoManager() { return mUndoManager.get(); }
|
||||||
|
|
||||||
sampleFormat GetDefaultFormat() { return mDefaultFormat; }
|
sampleFormat GetDefaultFormat() { return mDefaultFormat; }
|
||||||
|
@ -2749,6 +2749,50 @@ void TrackPanel::EnsureVisible(Track * t)
|
|||||||
Refresh(false);
|
Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 0.0 scrolls to top
|
||||||
|
// 1.0 scrolls to bottom.
|
||||||
|
void TrackPanel::VerticalScroll( float fracPosition){
|
||||||
|
TrackListIterator iter(GetTracks());
|
||||||
|
Track *it = NULL;
|
||||||
|
Track *nt = NULL;
|
||||||
|
|
||||||
|
// Compute trackHeight
|
||||||
|
int trackTop = 0;
|
||||||
|
int trackHeight =0;
|
||||||
|
|
||||||
|
for (it = iter.First(); it; it = iter.Next()) {
|
||||||
|
trackTop += trackHeight;
|
||||||
|
trackHeight = it->GetHeight();
|
||||||
|
|
||||||
|
//find the second track if this is stereo
|
||||||
|
if (it->GetLinked()) {
|
||||||
|
nt = iter.Next();
|
||||||
|
trackHeight += nt->GetHeight();
|
||||||
|
}
|
||||||
|
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||||
|
else if(MONO_WAVE_PAN(it)){
|
||||||
|
trackHeight += it->GetHeight(true);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
else {
|
||||||
|
nt = it;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int delta;
|
||||||
|
|
||||||
|
//Get the size of the trackpanel.
|
||||||
|
int width, height;
|
||||||
|
GetSize(&width, &height);
|
||||||
|
|
||||||
|
delta = (fracPosition * (trackTop + trackHeight - height)) - mViewInfo->vpos + mViewInfo->scrollStep;
|
||||||
|
//wxLogDebug( "Scroll down by %i pixels", delta );
|
||||||
|
delta /= mViewInfo->scrollStep;
|
||||||
|
mListener->TP_ScrollUpDown(delta);
|
||||||
|
Refresh(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Given rectangle excludes the insets left, right, and top
|
// Given rectangle excludes the insets left, right, and top
|
||||||
// Draw a rectangular border and also a vertical separator of track controls
|
// Draw a rectangular border and also a vertical separator of track controls
|
||||||
// from the rest (ruler and proper track area)
|
// from the rest (ruler and proper track area)
|
||||||
|
@ -332,6 +332,7 @@ class AUDACITY_DLL_API TrackPanel final : public OverlayPanel {
|
|||||||
bool IsMouseCaptured();
|
bool IsMouseCaptured();
|
||||||
|
|
||||||
void EnsureVisible(Track * t);
|
void EnsureVisible(Track * t);
|
||||||
|
void VerticalScroll( float fracPosition);
|
||||||
|
|
||||||
Track *GetFocusedTrack();
|
Track *GetFocusedTrack();
|
||||||
void SetFocusedTrack(Track *t);
|
void SetFocusedTrack(Track *t);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user