1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 23:33:49 +01:00

ScrollIntoView out of TrackPanel, into ProjectWindow

This commit is contained in:
Paul Licameli
2019-06-08 09:02:17 -04:00
parent b0d03d09a2
commit 52ff705b0d
9 changed files with 52 additions and 52 deletions

View File

@@ -2,6 +2,7 @@
#include "../ProjectHistory.h"
#include "../ProjectSettings.h"
#include "../TrackPanel.h"
#include "../ProjectWindow.h"
#include "../UndoManager.h"
#include "../WaveClip.h"
#include "../ViewInfo.h"
@@ -561,6 +562,7 @@ void DoSelectClip(AudacityProject &project, bool next)
{
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto &trackPanel = TrackPanel::Get( project );
auto &window = ProjectWindow::Get( project );
std::vector<FoundClip> results;
FindClips(project, selectedRegion.t0(),
@@ -573,7 +575,7 @@ void DoSelectClip(AudacityProject &project, bool next)
double t1 = results[0].endTime;
selectedRegion.setTimes(t0, t1);
ProjectHistory::Get( project ).ModifyState(false);
trackPanel.ScrollIntoView(selectedRegion.t0());
window.ScrollIntoView(selectedRegion.t0());
// create and send message to screen reader
wxString message;
@@ -607,6 +609,7 @@ void DoCursorClipBoundary
{
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto &trackPanel = TrackPanel::Get( project );
auto &window = ProjectWindow::Get( project );
std::vector<FoundClipBoundary> results;
FindClipBoundaries(project, next ? selectedRegion.t1() :
@@ -618,7 +621,7 @@ void DoCursorClipBoundary
double time = results[0].time;
selectedRegion.setTimes(time, time);
ProjectHistory::Get( project ).ModifyState(false);
trackPanel.ScrollIntoView(selectedRegion.t0());
window.ScrollIntoView(selectedRegion.t0());
wxString message = ClipBoundaryMessage(results);
trackPanel.MessageForScreenReader(message);
@@ -691,6 +694,7 @@ void DoClipLeftOrRight
(AudacityProject &project, bool right, bool keyUp )
{
auto &undoManager = UndoManager::Get( project );
auto &window = ProjectWindow::Get( project );
if (keyUp) {
undoManager.StopConsolidating();
@@ -707,7 +711,7 @@ void DoClipLeftOrRight
auto amount = DoClipMove( viewInfo, trackPanel.GetFocusedTrack(),
tracks, isSyncLocked, right );
trackPanel.ScrollIntoView(selectedRegion.t0());
window.ScrollIntoView(selectedRegion.t0());
if (amount != 0.0) {
wxString message = right? _("Time shifted clips to the right") :

View File

@@ -41,7 +41,6 @@ void FinishCopy
bool DoPasteText(AudacityProject &project)
{
auto &tracks = TrackList::Get( project );
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto &window = ProjectWindow::Get( project );
@@ -61,7 +60,7 @@ bool DoPasteText(AudacityProject &project)
// Make sure caret is in view
int x;
if (view.CalcCursorX( project, &x )) {
trackPanel.ScrollIntoView(x);
window.ScrollIntoView(x);
}
return true;

View File

@@ -273,7 +273,7 @@ void MoveWhenAudioInactive
}
// Make sure NEW position is in view
trackPanel.ScrollIntoView(viewInfo.selectedRegion.t1());
window.ScrollIntoView(viewInfo.selectedRegion.t1());
return;
}
@@ -282,9 +282,9 @@ void SeekWhenAudioInactive
SelectionOperation operation)
{
auto &viewInfo = ViewInfo::Get( project );
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
const auto &settings = ProjectSettings::Get( project );
auto &window = ProjectWindow::Get( project );
if( operation == CURSOR_MOVE )
{
@@ -318,9 +318,8 @@ SelectionOperation operation)
else
viewInfo.selectedRegion.setT1( newT );
// Ensure it is visible, and refresh.
trackPanel.ScrollIntoView(newT);
trackPanel.Refresh(false);
// Ensure it is visible
window.ScrollIntoView(newT);
}
// Handle small cursor and play head movements
@@ -381,8 +380,8 @@ void DoCursorMove(
void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
{
auto &viewInfo = ViewInfo::Get( project );
auto &trackPanel = TrackPanel::Get( project );
auto &tracks = TrackList::Get( project );
auto &window = ProjectWindow::Get( project );
// step is negative, then is moving left. step positive, moving right.
// Move the left/right selection boundary, to expand the selection
@@ -434,9 +433,8 @@ void DoBoundaryMove(AudacityProject &project, int step, SeekInfo &info)
else
viewInfo.selectedRegion.setT1( newT );
// Ensure it is visible, and refresh.
trackPanel.ScrollIntoView(newT);
trackPanel.Refresh(false);
// Ensure it is visible
window.ScrollIntoView(newT);
ProjectHistory::Get( project ).ModifyState(false);
}
@@ -834,31 +832,31 @@ void OnSelContractRight(const CommandContext &context)
void OnCursorSelStart(const CommandContext &context)
{
auto &project = context.project;
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto &window = ProjectWindow::Get( project );
selectedRegion.collapseToT0();
ProjectHistory::Get( project ).ModifyState(false);
trackPanel.ScrollIntoView(selectedRegion.t0());
window.ScrollIntoView(selectedRegion.t0());
}
void OnCursorSelEnd(const CommandContext &context)
{
auto &project = context.project;
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto &window = ProjectWindow::Get( project );
selectedRegion.collapseToT1();
ProjectHistory::Get( project ).ModifyState(false);
trackPanel.ScrollIntoView(selectedRegion.t1());
window.ScrollIntoView(selectedRegion.t1());
}
void OnCursorTrackStart(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto &window = ProjectWindow::Get( project );
double kWayOverToRight = std::numeric_limits<double>::max();
@@ -876,15 +874,15 @@ void OnCursorTrackStart(const CommandContext &context)
selectedRegion.setTimes(minOffset, minOffset);
ProjectHistory::Get( project ).ModifyState(false);
trackPanel.ScrollIntoView(selectedRegion.t0());
window.ScrollIntoView(selectedRegion.t0());
}
void OnCursorTrackEnd(const CommandContext &context)
{
auto &project = context.project;
auto &tracks = TrackList::Get( project );
auto &trackPanel = TrackPanel::Get( project );
auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
auto &window = ProjectWindow::Get( project );
double kWayOverToLeft = std::numeric_limits<double>::lowest();
@@ -902,7 +900,7 @@ void OnCursorTrackEnd(const CommandContext &context)
selectedRegion.setTimes(maxEndOffset, maxEndOffset);
ProjectHistory::Get( project ).ModifyState(false);
trackPanel.ScrollIntoView(selectedRegion.t1());
window.ScrollIntoView(selectedRegion.t1());
}
void OnSkipStart(const CommandContext &context)

View File

@@ -173,7 +173,7 @@ void DoMoveToLabel(AudacityProject &project, bool next)
}
else {
selectedRegion = label->selectedRegion;
trackPanel.ScrollIntoView(selectedRegion.t0());
window.ScrollIntoView(selectedRegion.t0());
window.RedrawProject();
}