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. // 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 // This updates related displays such as numbers on the status bar
mProject->TP_DisplaySelection(); mProject->TP_DisplaySelection();

View File

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

View File

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

View File

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