mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-03 09:29:30 +02:00
Merge: Bug977: Enable new scrolling limits as a Tracks preference, default off.
This commit is contained in:
commit
bc294872e5
@ -767,6 +767,7 @@ AudacityProject::AudacityProject(wxWindow * parent, wxWindowID id,
|
|||||||
mIsDeleting(false),
|
mIsDeleting(false),
|
||||||
mTracksFitVerticallyZoomed(false), //lda
|
mTracksFitVerticallyZoomed(false), //lda
|
||||||
mShowId3Dialog(true), //lda
|
mShowId3Dialog(true), //lda
|
||||||
|
mScrollBeyondZero(false),
|
||||||
mLastFocusedWindow(NULL),
|
mLastFocusedWindow(NULL),
|
||||||
mKeyboardCaptured(NULL),
|
mKeyboardCaptured(NULL),
|
||||||
mImportXMLTagHandler(NULL),
|
mImportXMLTagHandler(NULL),
|
||||||
@ -1060,6 +1061,9 @@ AudioIOStartStreamOptions AudacityProject::GetDefaultPlayOptions()
|
|||||||
|
|
||||||
void AudacityProject::UpdatePrefsVariables()
|
void AudacityProject::UpdatePrefsVariables()
|
||||||
{
|
{
|
||||||
|
#ifdef EXPERIMENTAL_SCROLLING_LIMITS
|
||||||
|
gPrefs->Read(wxT("/GUI/ScrollBeyondZero"), &mScrollBeyondZero, false);
|
||||||
|
#endif
|
||||||
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &mShowId3Dialog, true);
|
gPrefs->Read(wxT("/AudioFiles/ShowId3Dialog"), &mShowId3Dialog, true);
|
||||||
gPrefs->Read(wxT("/AudioFiles/NormalizeOnLoad"),&mNormalizeOnLoad, false);
|
gPrefs->Read(wxT("/AudioFiles/NormalizeOnLoad"),&mNormalizeOnLoad, false);
|
||||||
gPrefs->Read(wxT("/GUI/AutoScroll"), &mViewInfo.bUpdateTrackIndicator, true);
|
gPrefs->Read(wxT("/GUI/AutoScroll"), &mViewInfo.bUpdateTrackIndicator, true);
|
||||||
@ -1457,10 +1461,7 @@ void AudacityProject::OnScrollRightButton(wxScrollEvent & event)
|
|||||||
|
|
||||||
void AudacityProject::SetHorizontalThumb(double scrollto)
|
void AudacityProject::SetHorizontalThumb(double scrollto)
|
||||||
{
|
{
|
||||||
double timeOffset = 0;
|
const double timeOffset = mScrollBeyondZero ? mViewInfo.screen / 2.0 : 0;
|
||||||
#ifdef EXPERIMENTAL_SCROLLING_LIMITS
|
|
||||||
timeOffset = mViewInfo.screen / 2.0;
|
|
||||||
#endif
|
|
||||||
int pos = (int) (
|
int pos = (int) (
|
||||||
(scrollto + timeOffset) * mViewInfo.zoom * mViewInfo.sbarScale
|
(scrollto + timeOffset) * mViewInfo.zoom * mViewInfo.sbarScale
|
||||||
);
|
);
|
||||||
@ -1536,20 +1537,18 @@ void AudacityProject::FixScrollbars()
|
|||||||
|
|
||||||
mViewInfo.screen = ((double) panelWidth) / mViewInfo.zoom;
|
mViewInfo.screen = ((double) panelWidth) / mViewInfo.zoom;
|
||||||
const double halfScreen = mViewInfo.screen / 2.0;
|
const double halfScreen = mViewInfo.screen / 2.0;
|
||||||
double additional, lowerBound;
|
|
||||||
#ifdef EXPERIMENTAL_SCROLLING_LIMITS
|
// If we can scroll beyond zero,
|
||||||
// Add 1/2 of a screen of blank space to the end
|
// Add 1/2 of a screen of blank space to the end
|
||||||
// and another 1/2 screen before the beginning
|
// and another 1/2 screen before the beginning
|
||||||
// so that any point within the union of the selection and the track duration
|
// so that any point within the union of the selection and the track duration
|
||||||
// may be scrolled to the midline.
|
// may be scrolled to the midline.
|
||||||
// May add even more to the end, so that you can always scroll the starting time to zero.
|
// May add even more to the end, so that you can always scroll the starting time to zero.
|
||||||
additional = halfScreen + std::max(halfScreen, mViewInfo.screen - LastTime);
|
const double additional = mScrollBeyondZero
|
||||||
lowerBound = - halfScreen;
|
? halfScreen + std::max(halfScreen, mViewInfo.screen - LastTime)
|
||||||
#else
|
: mViewInfo.screen / 4.0;
|
||||||
// Formerly just added 1/4 screen at the end
|
const double lowerBound = mScrollBeyondZero ? -halfScreen : 0.0;
|
||||||
additional = mViewInfo.screen / 4.0;
|
|
||||||
lowerBound = 0.0;
|
|
||||||
#endif
|
|
||||||
mViewInfo.total = LastTime + additional;
|
mViewInfo.total = LastTime + additional;
|
||||||
|
|
||||||
// Don't remove time from total that's still on the screen
|
// Don't remove time from total that's still on the screen
|
||||||
@ -1822,17 +1821,14 @@ void AudacityProject::OnODTaskComplete(wxCommandEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
void AudacityProject::OnScroll(wxScrollEvent & WXUNUSED(event))
|
void AudacityProject::OnScroll(wxScrollEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxInt64 hlast = mViewInfo.sbarH;
|
const wxInt64 hlast = mViewInfo.sbarH;
|
||||||
|
|
||||||
|
const wxInt64 offset = mScrollBeyondZero
|
||||||
|
? (0.5 + (mViewInfo.zoom * mViewInfo.screen / 2.0))
|
||||||
|
: 0.0;
|
||||||
|
const double lowerBound = mScrollBeyondZero
|
||||||
|
? -mViewInfo.screen / 2.0 : 0.0;
|
||||||
|
|
||||||
double lowerBound;
|
|
||||||
wxInt64 offset;
|
|
||||||
#ifdef EXPERIMENTAL_SCROLLING_LIMITS
|
|
||||||
offset = (0.5 + (mViewInfo.zoom * mViewInfo.screen / 2.0));
|
|
||||||
lowerBound = -mViewInfo.screen / 2.0;
|
|
||||||
#else
|
|
||||||
offset = 0.0;
|
|
||||||
lowerBound = 0.0;
|
|
||||||
#endif
|
|
||||||
mViewInfo.sbarH =
|
mViewInfo.sbarH =
|
||||||
(wxInt64)(mHsbar->GetThumbPosition() / mViewInfo.sbarScale) - offset;
|
(wxInt64)(mHsbar->GetThumbPosition() / mViewInfo.sbarScale) - offset;
|
||||||
|
|
||||||
@ -1846,14 +1842,15 @@ void AudacityProject::OnScroll(wxScrollEvent & WXUNUSED(event))
|
|||||||
mViewInfo.h = lowerBound;
|
mViewInfo.h = lowerBound;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EXPERIMENTAL_SCROLLING_LIMITS
|
|
||||||
|
if (mScrollBeyondZero) {
|
||||||
enum { SCROLL_PIXEL_TOLERANCE = 10 };
|
enum { SCROLL_PIXEL_TOLERANCE = 10 };
|
||||||
if (fabs(mViewInfo.h * mViewInfo.zoom) < SCROLL_PIXEL_TOLERANCE) {
|
if (fabs(mViewInfo.h * mViewInfo.zoom) < SCROLL_PIXEL_TOLERANCE) {
|
||||||
// Snap the scrollbar to 0
|
// Snap the scrollbar to 0
|
||||||
mViewInfo.h = 0;
|
mViewInfo.h = 0;
|
||||||
SetHorizontalThumb(0.0);
|
SetHorizontalThumb(0.0);
|
||||||
}
|
}
|
||||||
#endif
|
}
|
||||||
|
|
||||||
int lastv = mViewInfo.vpos;
|
int lastv = mViewInfo.vpos;
|
||||||
mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
|
mViewInfo.vpos = mVsbar->GetThumbPosition() * mViewInfo.scrollStep;
|
||||||
|
@ -576,6 +576,9 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
|
|||||||
bool mNormalizeOnLoad; //lda
|
bool mNormalizeOnLoad; //lda
|
||||||
bool mShowId3Dialog; //lda
|
bool mShowId3Dialog; //lda
|
||||||
bool mEmptyCanBeDirty;
|
bool mEmptyCanBeDirty;
|
||||||
|
|
||||||
|
bool mScrollBeyondZero;
|
||||||
|
|
||||||
bool mSelectAllOnNone;
|
bool mSelectAllOnNone;
|
||||||
|
|
||||||
bool mIsSyncLocked;
|
bool mIsSyncLocked;
|
||||||
|
@ -830,6 +830,9 @@ void TrackPanel::UpdateVirtualStereoOrder()
|
|||||||
|
|
||||||
void TrackPanel::UpdatePrefs()
|
void TrackPanel::UpdatePrefs()
|
||||||
{
|
{
|
||||||
|
#ifdef EXPERIMENTAL_SCROLLING_LIMITS
|
||||||
|
gPrefs->Read(wxT("/GUI/ScrollBeyondZero"), &mScrollBeyondZero, false);
|
||||||
|
#endif
|
||||||
mdBr = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
|
mdBr = gPrefs->Read(wxT("/GUI/EnvdBRange"), ENV_DB_RANGE);
|
||||||
gPrefs->Read(wxT("/GUI/AutoScroll"), &mViewInfo->bUpdateTrackIndicator,
|
gPrefs->Read(wxT("/GUI/AutoScroll"), &mViewInfo->bUpdateTrackIndicator,
|
||||||
true);
|
true);
|
||||||
@ -1488,10 +1491,9 @@ void TrackPanel::OnPaint(wxPaintEvent & /* event */)
|
|||||||
// at higher magnifications, and keeps the green line still in the middle.
|
// at higher magnifications, and keeps the green line still in the middle.
|
||||||
indicator = gAudioIO->GetStreamTime();
|
indicator = gAudioIO->GetStreamTime();
|
||||||
mViewInfo->h = indicator - mViewInfo->screen / 2.0;
|
mViewInfo->h = indicator - mViewInfo->screen / 2.0;
|
||||||
#if !defined(EXPERIMENTAL_SCROLLING_LIMITS)
|
if (!mScrollBeyondZero)
|
||||||
// Can't scroll too far left
|
// Can't scroll too far left
|
||||||
mViewInfo->h = std::max(0.0, mViewInfo->h);
|
mViewInfo->h = std::max(0.0, mViewInfo->h);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -766,6 +766,7 @@ protected:
|
|||||||
enum MouseCaptureEnum mMouseCapture;
|
enum MouseCaptureEnum mMouseCapture;
|
||||||
virtual void SetCapturedTrack( Track * t, enum MouseCaptureEnum MouseCapture=IsUncaptured );
|
virtual void SetCapturedTrack( Track * t, enum MouseCaptureEnum MouseCapture=IsUncaptured );
|
||||||
|
|
||||||
|
bool mScrollBeyondZero;
|
||||||
bool mAdjustSelectionEdges;
|
bool mAdjustSelectionEdges;
|
||||||
bool mSlideUpDownOnly;
|
bool mSlideUpDownOnly;
|
||||||
bool mCircularTrackNavigation;
|
bool mCircularTrackNavigation;
|
||||||
|
@ -18,13 +18,13 @@
|
|||||||
*//*******************************************************************/
|
*//*******************************************************************/
|
||||||
|
|
||||||
#include "../Audacity.h"
|
#include "../Audacity.h"
|
||||||
|
#include "TracksPrefs.h"
|
||||||
|
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
|
|
||||||
|
#include "../Experimental.h"
|
||||||
#include "../ShuttleGui.h"
|
#include "../ShuttleGui.h"
|
||||||
|
|
||||||
#include "TracksPrefs.h"
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TracksPrefs::TracksPrefs(wxWindow * parent)
|
TracksPrefs::TracksPrefs(wxWindow * parent)
|
||||||
@ -116,6 +116,11 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
|
|||||||
S.TieCheckBox(_("Editing a clip can &move other clips"),
|
S.TieCheckBox(_("Editing a clip can &move other clips"),
|
||||||
wxT("/GUI/EditClipCanMove"),
|
wxT("/GUI/EditClipCanMove"),
|
||||||
true);
|
true);
|
||||||
|
#ifdef EXPERIMENTAL_SCROLLING_LIMITS
|
||||||
|
S.TieCheckBox(_("Enable scrolling left of &zero"),
|
||||||
|
wxT("/GUI/ScrollBeyondZero"),
|
||||||
|
false);
|
||||||
|
#endif
|
||||||
|
|
||||||
S.AddSpace(10);
|
S.AddSpace(10);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user