1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-19 14:17:41 +02:00

Merge branch 'master' into scrubbing2

This commit is contained in:
Paul Licameli 2016-04-27 18:36:10 -04:00
commit b7dc2561b6
5 changed files with 4212 additions and 4221 deletions

File diff suppressed because it is too large Load Diff

View File

@ -111,7 +111,7 @@ void EditCursorOverlay::Draw
}
// AS: Ah, no, this is where we draw the blinky thing in the ruler.
mProject->GetRulerPanel()->DrawCursor(mCursorTime);
mProject->GetRulerPanel()->Refresh();
// This updates related displays such as numbers on the status bar
mProject->TP_DisplaySelection();

View File

@ -95,7 +95,7 @@ private:
// I need this because I can't push the scrubber as an event handler
// in two places at once.
struct Forwarder : public wxEvtHandler {
Forwarder(Scrubber &scrubber_) : scrubber{ scrubber_ } {}
Forwarder(Scrubber &scrubber_) : scrubber( scrubber_ ) {}
Scrubber &scrubber;

View File

@ -96,6 +96,8 @@ using std::max;
#define kTopInset 4
wxColour Ruler::mTickColour{ 153, 153, 153 };
//
// Ruler
//
@ -120,7 +122,6 @@ Ruler::Ruler()
mBottom = -1;
mbTicksOnly = true;
mbTicksAtExtremes = false;
mTickColour = wxColour(153,153,153);
mPen.SetColour(mTickColour);
// Note: the font size is now adjusted automatically whenever
@ -1572,7 +1573,7 @@ void Ruler::Label::Draw(wxDC&dc, bool twoTone) const
#ifdef EXPERIMENTAL_THEMING
// TODO: handle color distinction
mDC->SetTextForeground(mTickColour);
dc.SetTextForeground(mTickColour);
#else
dc.SetTextForeground(altColor ? *wxBLUE : *wxBLACK);
#endif
@ -1792,7 +1793,6 @@ AdornedRulerPanel::AdornedRulerPanel(AudacityProject* parent,
mCursorSizeWE = wxCursor(wxCURSOR_SIZEWE);
mLeftOffset = 0;
mCurTime = -1;
mIndTime = -1;
mIndType = -1;
mQuickPlayInd = false;
@ -1933,6 +1933,7 @@ void AdornedRulerPanel::OnCapture(wxCommandEvent & evt)
enum : int {
IndicatorSmallWidth = 9,
IndicatorMediumWidth = 13,
IndicatorOffset = 1,
};
@ -1985,8 +1986,9 @@ void AdornedRulerPanel::OnPaint(wxPaintEvent & WXUNUSED(evt))
if (mIndType >= 0)
{
DoDrawIndicator(&mBackDC, mIndTime, mIndType != 0,
IndicatorBigWidth());
const bool scrub = mProject->GetScrubber().HasStartedScrubbing();
auto width = scrub ? IndicatorBigWidth() : IndicatorMediumWidth;
DoDrawIndicator(&mBackDC, mIndTime, mIndType != 0, width, scrub);
}
if (mViewInfo->selectedRegion.isPoint())
@ -2720,16 +2722,9 @@ void AdornedRulerPanel::SetLeftOffset(int offset)
mRuler.SetUseZoomInfo(offset, mViewInfo);
}
void AdornedRulerPanel::DrawCursor(double time)
{
mCurTime = time;
Refresh();
}
void AdornedRulerPanel::DoDrawCursor(wxDC * dc)
{
const int x = Time2Pos(mCurTime);
const int x = Time2Pos(mViewInfo->selectedRegion.t0());
// Draw cursor in ruler
dc->DrawLine( x, 1, x, mInner.height );
@ -2762,18 +2757,15 @@ void AdornedRulerPanel::DrawIndicator( double time, bool rec )
}
// Draws the play/recording position indicator.
void AdornedRulerPanel::DoDrawIndicator(wxDC * dc, double time, bool playing, int width)
void AdornedRulerPanel::DoDrawIndicator
(wxDC * dc, double time, bool playing, int width, bool scrub)
{
const int x = Time2Pos(time);
AColor::IndicatorColor( dc, playing );
wxPoint tri[ 3 ];
if (playing && // Don't ever draw the double-head if recording!
(mPrevInScrubZone ||
mProject->GetScrubber().HasStartedScrubbing())) {
// Always draw big
width = IndicatorBigWidth();
if (scrub) {
auto height = IndicatorHeightForWidth(width);
const int IndicatorHalfWidth = width / 2;
@ -2854,7 +2846,9 @@ void AdornedRulerPanel::DrawQuickPlayIndicator(wxDC * dc)
DoEraseIndicator(dc, mLastQuickPlayX);
mLastQuickPlayX = x;
DoDrawIndicator(dc, mQuickPlayPos, true, IndicatorSmallWidth);
auto scrub = mPrevInScrubZone || mProject->GetScrubber().HasStartedScrubbing();
auto width = scrub ? IndicatorBigWidth() : IndicatorSmallWidth;
DoDrawIndicator(dc, mQuickPlayPos, true, width, scrub);
}
void AdornedRulerPanel::SetPlayRegion(double playRegionStart,

View File

@ -168,7 +168,7 @@ public:
wxRect mRect;
private:
wxColour mTickColour;
static wxColour mTickColour;
wxPen mPen;
int mMaxWidth, mMaxHeight;
@ -294,7 +294,6 @@ public:
static int GetRulerHeight() { return 28; }
void SetLeftOffset(int offset);
void DrawCursor(double time);
void DrawIndicator(double time, bool rec);
void DrawSelection();
void ClearIndicator();
@ -334,7 +333,7 @@ private:
void DoDrawMarks(wxDC * dc, bool /*text */ );
void DoDrawCursor(wxDC * dc);
void DoDrawSelection(wxDC * dc);
void DoDrawIndicator(wxDC * dc, double time, bool recording, int width);
void DoDrawIndicator(wxDC * dc, double time, bool playing, int width, bool scrub);
void DoEraseIndicator(wxDC *dc, int x);
QuickPlayIndicatorOverlay *GetOverlay();
void DrawQuickPlayIndicator(wxDC * dc /*NULL to DELETE old only*/);
@ -368,8 +367,6 @@ private:
int mLeftOffset; // Number of pixels before we hit the 'zero position'.
double mCurTime;
int mIndType; // -1 = No indicator, 0 = Record, 1 = Play
double mIndTime;