1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-07 15:22:34 +02:00

Disabled experimental mouse-over highlights of more TrackPanel things

This commit is contained in:
Paul Licameli 2017-07-11 13:58:37 -04:00
commit cfb67e2f18
20 changed files with 266 additions and 81 deletions

View File

@ -87,6 +87,9 @@ wxBrush AColor::tooltipBrush;
wxPen AColor::sparePen;
wxBrush AColor::spareBrush;
wxPen AColor::uglyPen;
wxBrush AColor::uglyBrush;
//
// Draw an upward or downward pointing arrow.
//
@ -262,7 +265,7 @@ wxColour AColor::Blend( const wxColour & c1, const wxColour & c2 )
return c3;
}
void AColor::BevelTrackInfo(wxDC & dc, bool up, const wxRect & r)
void AColor::BevelTrackInfo(wxDC & dc, bool up, const wxRect & r, bool highlight)
{
#ifndef EXPERIMENTAL_THEMING
Bevel( dc, up, r );
@ -270,7 +273,7 @@ void AColor::BevelTrackInfo(wxDC & dc, bool up, const wxRect & r)
wxColour col;
col = Blend( theTheme.Colour( clrTrackInfo ), up ? wxColour( 255,255,255):wxColour(0,0,0));
wxPen pen( col );
wxPen pen( highlight ? uglyPen : col );
dc.SetPen( pen );
dc.DrawLine(r.x, r.y, r.x + r.width, r.y);
@ -279,7 +282,7 @@ void AColor::BevelTrackInfo(wxDC & dc, bool up, const wxRect & r)
col = Blend( theTheme.Colour( clrTrackInfo ), up ? wxColour(0,0,0): wxColour(255,255,255));
pen.SetColour( col );
dc.SetPen( pen );
dc.SetPen( highlight ? uglyPen : pen );
dc.DrawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
dc.DrawLine(r.x, r.y + r.height, r.x + r.width + 1, r.y + r.height);
@ -299,13 +302,15 @@ void AColor::UseThemeColour( wxDC * dc, int iIndex, int index2 )
dc->SetPen( sparePen );
}
void AColor::Light(wxDC * dc, bool selected)
void AColor::Light(wxDC * dc, bool selected, bool highlight)
{
if (!inited)
Init();
int index = (int) selected;
dc->SetBrush(lightBrush[index]);
dc->SetPen(lightPen[index]);
auto &brush = highlight ? AColor::uglyBrush : lightBrush[index];
dc->SetBrush( brush );
auto &pen = highlight ? AColor::uglyPen : lightPen[index];
dc->SetPen( pen );
}
void AColor::Medium(wxDC * dc, bool selected)
@ -327,13 +332,15 @@ void AColor::MediumTrackInfo(wxDC * dc, bool selected)
}
void AColor::Dark(wxDC * dc, bool selected)
void AColor::Dark(wxDC * dc, bool selected, bool highlight)
{
if (!inited)
Init();
int index = (int) selected;
dc->SetBrush(darkBrush[index]);
dc->SetPen(darkPen[index]);
auto &brush = highlight ? AColor::uglyBrush : darkBrush[index];
dc->SetBrush( brush );
auto &pen = highlight ? AColor::uglyPen : darkPen[index];
dc->SetPen( pen );
}
void AColor::TrackPanelBackground(wxDC * dc, bool selected)
@ -503,6 +510,9 @@ void AColor::Init()
tooltipPen.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOTEXT) );
tooltipBrush.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOBK) );
uglyPen.SetColour( wxColour{ 0, 255, 0 } ); // saturated green
uglyBrush.SetColour( wxColour{ 255, 0, 255 } ); // saturated magenta
// A tiny gradient of yellow surrounding the current focused track
theTheme.SetPenColour( trackFocusPens[0], clrTrackFocus0);
theTheme.SetPenColour( trackFocusPens[1], clrTrackFocus1);

View File

@ -68,16 +68,16 @@ class AColor {
static void Bevel(wxDC & dc, bool up, const wxRect & r);
static void Bevel2
(wxDC & dc, bool up, const wxRect & r, bool bSel=false, bool bHighlight = false);
static void BevelTrackInfo(wxDC & dc, bool up, const wxRect & r);
static void BevelTrackInfo(wxDC & dc, bool up, const wxRect & r, bool highlight = false);
static wxColour Blend(const wxColour & c1, const wxColour & c2);
static void UseThemeColour( wxDC * dc, int iIndex, int index2 =-1 );
static void TrackPanelBackground(wxDC * dc, bool selected);
static void Light(wxDC * dc, bool selected);
static void Light(wxDC * dc, bool selected, bool highlight = false);
static void Medium(wxDC * dc, bool selected);
static void MediumTrackInfo(wxDC * dc, bool selected);
static void Dark(wxDC * dc, bool selected);
static void Dark(wxDC * dc, bool selected, bool highlight = false);
static void CursorColor(wxDC * dc);
static void IndicatorColor(wxDC * dc, bool bIsNotRecording);
@ -139,6 +139,10 @@ class AColor {
static const int gradientSteps = 512;
static unsigned char gradient_pre[ColorGradientTotal][2][gradientSteps][3];
// For experiments in mouse-over highlighting only
static wxPen uglyPen;
static wxBrush uglyBrush;
private:
static wxPen sparePen;
static wxBrush spareBrush;

View File

@ -27,6 +27,7 @@ a draggable point type.
*//*******************************************************************/
#include "Envelope.h"
#include "Experimental.h"
#include "ViewInfo.h"
#include <math.h>
@ -312,6 +313,7 @@ static void DrawPoint(wxDC & dc, const wxRect & r, int x, int y, bool top)
}
#include "TrackPanelDrawingContext.h"
#include "tracks/ui/EnvelopeHandle.h"
/// TODO: This should probably move to track artist.
void Envelope::DrawPoints
@ -320,7 +322,13 @@ void Envelope::DrawPoints
float zoomMin, float zoomMax, bool mirrored) const
{
auto &dc = context.dc;
dc.SetPen(AColor::envelopePen);
bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<EnvelopeHandle*>(context.target.get());
highlight = target && target->GetEnvelope() == this;
#endif
wxPen &pen = highlight ? AColor::uglyPen : AColor::envelopePen;
dc.SetPen( pen );
dc.SetBrush(*wxWHITE_BRUSH);
for (int i = 0; i < (int)mEnv.size(); i++) {
@ -329,7 +337,7 @@ void Envelope::DrawPoints
if (position >= 0 && position < r.width) {
// Change colour if this is the draggable point...
if (i == mDragPoint) {
dc.SetPen(AColor::envelopePen);
dc.SetPen( pen );
dc.SetBrush(AColor::envelopeBrush);
}
@ -371,7 +379,7 @@ void Envelope::DrawPoints
// Change colour back again if was the draggable point.
if (i == mDragPoint) {
dc.SetPen(AColor::envelopePen);
dc.SetPen( pen );
dc.SetBrush(*wxWHITE_BRUSH);
}
}

View File

@ -208,4 +208,10 @@
// interpolating in frequency domain.
#define EXPERIMENTAL_ZERO_PADDED_SPECTROGRAMS
// PRL 11 Jul 2017
// Highlight more things in TrackPanel when the mouse moves over them,
// using delibrately ugly pens and brushes until there is better cooperation
// with themes
//#define EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
#endif

View File

@ -30,6 +30,7 @@ for drawing different aspects of the label and its text box.
#include "Audacity.h"
#include "LabelTrack.h"
#include "Experimental.h"
#include "TrackPanel.h"
#include <stdio.h>
@ -774,6 +775,7 @@ namespace {
}
#include "TrackPanelDrawingContext.h"
#include "tracks/labeltrack/ui/LabelTextHandle.h"
/// Draw calls other functions to draw the LabelTrack.
/// @param dc the device context
@ -840,13 +842,30 @@ void LabelTrack::Draw
}}
// Draw the label boxes.
{ int i = -1; for (auto &labelStruct : mLabels) { ++i;
if( mSelIndex==i)
dc.SetBrush(AColor::labelTextEditBrush);
labelStruct.DrawTextBox( dc, r );
if( mSelIndex==i)
dc.SetBrush(AColor::labelTextNormalBrush);
}}
{
bool highlightTrack = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<LabelTextHandle*>(context.target.get());
highlightTrack = target && target->GetTrack().get() == this;
#endif
int i = -1; for (auto &labelStruct : mLabels) { ++i;
bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
highlight = highlightTrack && target->GetLabelNum() == i;
#endif
bool selected = mSelIndex == i;
const wxBrush &brush = dc.GetBrush();
if( selected )
dc.SetBrush( AColor::labelTextEditBrush );
else if ( highlight )
dc.SetBrush( AColor::uglyBrush );
labelStruct.DrawTextBox( dc, r );
if (highlight || selected)
dc.SetBrush( brush );
}
}
// Draw highlights
if ((mInitialCursorPos != mCurrentCursorPos) && (mSelIndex >= 0 ))

View File

@ -15,6 +15,7 @@
#include "Audacity.h"
#include "TimeTrack.h"
#include "Experimental.h"
#include <cfloat>
#include <wx/intl.h>
@ -258,11 +259,17 @@ void TimeTrack::WriteXML(XMLWriter &xmlFile) const
}
#include "TrackPanelDrawingContext.h"
#include "tracks/ui/EnvelopeHandle.h"
void TimeTrack::Draw
(TrackPanelDrawingContext &context, const wxRect & r, const ZoomInfo &zoomInfo) const
{
auto &dc = context.dc;
bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<EnvelopeHandle*>(context.target.get());
highlight = target && target->GetEnvelope() == this->GetEnvelope();
#endif
double min = zoomInfo.PositionToTime(0);
double max = zoomInfo.PositionToTime(r.width);
@ -294,7 +301,8 @@ void TimeTrack::Draw
GetEnvelope()->GetValues
( 0, 0, envValues.get(), mid.width, 0, zoomInfo );
dc.SetPen(AColor::envelopePen);
wxPen &pen = highlight ? AColor::uglyPen : AColor::envelopePen;
dc.SetPen( pen );
double logLower = log(std::max(1.0e-7, mRangeLower)), logUpper = log(std::max(1.0e-7, mRangeUpper));
for (int x = 0; x < mid.width; x++)

View File

@ -518,6 +518,11 @@ void TrackArtist::DrawVRuler
(TrackPanelDrawingContext &context, const Track *t, wxRect & rect)
{
auto dc = &context.dc;
bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
highlight = rect.Contains(context.lastState.GetPosition());
#endif
int kind = t->GetKind();
// Label and Time tracks do not have a vruler
@ -560,7 +565,7 @@ void TrackArtist::DrawVRuler
wxRect bev = rect;
bev.Inflate(-1, 0);
bev.width += 1;
AColor::BevelTrackInfo(*dc, true, bev);
AColor::BevelTrackInfo(*dc, true, bev, highlight);
// Right align the ruler
wxRect rr = rect;
@ -583,7 +588,7 @@ void TrackArtist::DrawVRuler
if (kind == Track::Note) {
UpdateVRuler(t, rect);
dc->SetPen(*wxTRANSPARENT_PEN);
dc->SetPen(highlight ? AColor::uglyPen : *wxTRANSPARENT_PEN);
dc->SetBrush(*wxWHITE_BRUSH);
wxRect bev = rect;
bev.x++;
@ -1040,7 +1045,8 @@ void TrackArtist::DrawWaveformBackground(wxDC &dc, int leftOffset, const wxRect
bool dB, float dBRange,
double t0, double t1,
const ZoomInfo &zoomInfo,
bool drawEnvelope, bool bIsSyncLockSelected)
bool drawEnvelope, bool bIsSyncLockSelected,
bool highlightEnvelope)
{
// Visually (one vertical slice of the waveform background, on its side;
@ -1115,6 +1121,11 @@ void TrackArtist::DrawWaveformBackground(wxDC &dc, int leftOffset, const wxRect
dc.DrawRectangle(l, rect.y + lmaxtop, w, lminbot - lmaxtop);
}
if (highlightEnvelope && lmaxbot < lmintop - 1) {
dc.SetBrush( AColor::uglyBrush );
dc.DrawRectangle(l, rect.y + lmaxbot, w, lmintop - lmaxbot);
}
lmaxtop = maxtop;
lmintop = mintop;
lmaxbot = maxbot;
@ -1133,6 +1144,10 @@ void TrackArtist::DrawWaveformBackground(wxDC &dc, int leftOffset, const wxRect
else {
dc.DrawRectangle(l, rect.y + lmaxtop, w, lminbot - lmaxtop);
}
if (highlightEnvelope && lmaxbot < lmintop - 1) {
dc.SetBrush( AColor::uglyBrush );
dc.DrawRectangle(l, rect.y + lmaxbot, w, lmintop - lmaxbot);
}
// If sync-lock selected, draw in linked graphics.
if (bIsSyncLockSelected && t0 < t1) {
@ -1312,7 +1327,8 @@ void TrackArtist::DrawIndividualSamples(wxDC &dc, int leftOffset, const wxRect &
bool dB, float dBRange,
const WaveClip *clip,
const ZoomInfo &zoomInfo,
bool bigPoints, bool showPoints, bool muted)
bool bigPoints, bool showPoints, bool muted,
bool highlight)
{
const double toffset = clip->GetOffset();
double rate = clip->GetRate();
@ -1345,7 +1361,8 @@ void TrackArtist::DrawIndividualSamples(wxDC &dc, int leftOffset, const wxRect &
if (mShowClipping)
clipped.reinit( size_t(slen) );
dc.SetPen(muted ? muteSamplePen : samplePen);
auto &pen = highlight ? AColor::uglyPen : muted ? muteSamplePen : samplePen;
dc.SetPen( pen );
for (decltype(slen) s = 0; s < slen; s++) {
const double time = toffset + (s + s0).as_double() / rate;
@ -1376,7 +1393,10 @@ void TrackArtist::DrawIndividualSamples(wxDC &dc, int leftOffset, const wxRect &
pr.width = tickSize;
pr.height = tickSize;
//different colour when draggable.
dc.SetBrush( bigPoints ? dragsampleBrush : sampleBrush);
auto &brush = highlight
? AColor::uglyBrush
: bigPoints ? dragsampleBrush : sampleBrush;
dc.SetBrush( brush );
for (decltype(slen) s = 0; s < slen; s++) {
if (ypos[s] >= 0 && ypos[s] < rect.height) {
pr.x = rect.x + xpos[s] - tickSize/2;
@ -1417,11 +1437,12 @@ void TrackArtist::DrawIndividualSamples(wxDC &dc, int leftOffset, const wxRect &
void TrackArtist::DrawEnvelope(wxDC &dc, const wxRect &rect, const double env[],
float zoomMin, float zoomMax,
bool dB, float dBRange)
bool dB, float dBRange, bool highlight)
{
int h = rect.height;
dc.SetPen(AColor::envelopePen);
auto &pen = highlight ? AColor::uglyPen : AColor::envelopePen;
dc.SetPen( pen );
for (int x0 = 0; x0 < rect.width; ++x0) {
int cenvTop = GetWaveYPos(env[x0], zoomMin, zoomMax,
@ -1473,6 +1494,8 @@ void TrackArtist::DrawEnvLine(wxDC &dc, const wxRect &rect, int x0, int y0, int
}
}
#include "tracks/ui/TimeShiftHandle.h"
#include "tracks/playabletrack/wavetrack/ui/CutlineHandle.h"
void TrackArtist::DrawWaveform(TrackPanelDrawingContext &context,
const WaveTrack *track,
const wxRect & rect,
@ -1484,6 +1507,15 @@ void TrackArtist::DrawWaveform(TrackPanelDrawingContext &context,
bool muted)
{
auto &dc = context.dc;
bool highlight = false;
bool gripHit = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<TimeShiftHandle*>(context.target.get());
gripHit = target && target->IsGripHit();
highlight = target && target->GetTrack().get() == track;
#endif
const bool dB = !track->GetWaveformSettings().isLinear();
DrawBackgroundWithSelection(&dc, rect, track, blankSelectedBrush, blankBrush,
@ -1497,34 +1529,43 @@ void TrackArtist::DrawWaveform(TrackPanelDrawingContext &context,
// Update cache for locations, e.g. cutlines and merge points
track->UpdateLocationsCache();
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target2 = dynamic_cast<CutlineHandle*>(context.target.get());
#endif
for (const auto loc : track->GetCachedLocations()) {
bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
highlight =
target2 && target2->GetTrack().get() == track &&
target2->GetLocation() == loc;
#endif
const int xx = zoomInfo.TimeToPosition(loc.pos);
if (xx >= 0 && xx < rect.width) {
// delta is used to adjust the top and bottom edge of a split line.
int delta =0;
dc.SetPen(*wxGREY_PEN);
dc.SetPen( highlight ? AColor::uglyPen : *wxGREY_PEN );
AColor::Line(dc, (int) (rect.x + xx - 1), rect.y, (int) (rect.x + xx - 1), rect.y + rect.height);
if (loc.typ == WaveTrackLocation::locationCutLine) {
dc.SetPen(*wxRED_PEN);
dc.SetPen( highlight ? AColor::uglyPen : *wxRED_PEN );
}
else {
delta = rect.height/3;
#ifdef EXPERIMENTAL_DA
// JKC Black does not show up enough.
dc.SetPen(*wxWHITE_PEN);
dc.SetPen(highlight ? AColor::uglyPen : *wxWHITE_PEN);
#else
dc.SetPen(*wxBLACK_PEN);
dc.SetPen(highlight ? AColor::uglyPen : *wxBLACK_PEN);
#endif
}
AColor::Line(dc, (int) (rect.x + xx), rect.y+delta, (int) (rect.x + xx), rect.y - delta + rect.height);
dc.SetPen(*wxGREY_PEN);
dc.SetPen( highlight ? AColor::uglyPen : *wxGREY_PEN );
AColor::Line(dc, (int) (rect.x + xx + 1), rect.y+delta, (int) (rect.x + xx + 1), rect.y - delta + rect.height);
}
}
if (drawSliders) {
DrawTimeSlider(dc, rect, true); // directed right
DrawTimeSlider(dc, rect, false); // directed left
DrawTimeSlider(dc, rect, true, highlight && gripHit); // directed right
DrawTimeSlider(dc, rect, false, highlight && gripHit); // directed left
}
}
@ -1743,6 +1784,8 @@ void FindWavePortions
}
}
#include "tracks/playabletrack/wavetrack/ui/SampleHandle.h"
#include "tracks/ui/EnvelopeHandle.h"
void TrackArtist::DrawClipWaveform(TrackPanelDrawingContext &context,
const WaveTrack *track,
const WaveClip *clip,
@ -1759,6 +1802,12 @@ void TrackArtist::DrawClipWaveform(TrackPanelDrawingContext &context,
Profiler profiler;
#endif
bool highlightEnvelope = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<EnvelopeHandle*>(context.target.get());
highlightEnvelope = target && target->GetEnvelope() == clip->GetEnvelope();
#endif
const ClipParameters params(false, track, clip, rect, selectedRegion, zoomInfo);
const wxRect &hiddenMid = params.hiddenMid;
// The "hiddenMid" rect contains the part of the display actually
@ -1819,7 +1868,7 @@ void TrackArtist::DrawClipWaveform(TrackPanelDrawingContext &context,
track->ZeroLevelYCoordinate(mid),
dB, dBRange,
t0, t1, zoomInfo, drawEnvelope,
!track->GetSelected());
!track->GetSelected(), highlightEnvelope);
}
WaveDisplay display(hiddenMid.width);
@ -1949,18 +1998,24 @@ void TrackArtist::DrawClipWaveform(TrackPanelDrawingContext &context,
#endif
);
}
else
else {
bool highlight = false;
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
auto target = dynamic_cast<SampleHandle*>(context.target.get());
highlight = target && target->GetTrack().get() == track;
#endif
DrawIndividualSamples(dc, leftOffset, rect, zoomMin, zoomMax,
dB, dBRange,
clip, zoomInfo,
bigPoints, showPoints, muted);
bigPoints, showPoints, muted, highlight);
}
}
leftOffset += rect.width + skippedRight;
}
if (drawEnvelope) {
DrawEnvelope(dc, mid, env, zoomMin, zoomMax, dB, dBRange);
DrawEnvelope(dc, mid, env, zoomMin, zoomMax, dB, dBRange, highlightEnvelope);
clip->GetEnvelope()->DrawPoints
(context, rect, zoomInfo, dB, dBRange, zoomMin, zoomMax, true);
}
@ -1988,7 +2043,7 @@ void TrackArtist::DrawClipWaveform(TrackPanelDrawingContext &context,
void TrackArtist::DrawTimeSlider(wxDC & dc,
const wxRect & rect,
bool rightwards)
bool rightwards, bool highlight)
{
const int border = 3; // 3 pixels all round.
const int width = 6; // width of the drag box.
@ -2014,12 +2069,12 @@ void TrackArtist::DrawTimeSlider(wxDC & dc,
int yTop = rect.y + border;
int yBot = rect.y + rect.height - border - 1;
AColor::Light(&dc, false);
AColor::Light(&dc, false, highlight);
AColor::Line(dc, xLeft, yBot - leftTaper, xLeft, yTop + leftTaper);
AColor::Line(dc, xLeft, yTop + leftTaper, xLeft + xFlat, yTop);
AColor::Line(dc, xLeft + xFlat, yTop, xLeft + width, yTop + rightTaper);
AColor::Dark(&dc, false);
AColor::Dark(&dc, false, highlight);
AColor::Line(dc, xLeft + width, yTop + rightTaper, xLeft + width, yBot - rightTaper);
AColor::Line(dc, xLeft + width, yBot - rightTaper, xLeft + width-xFlat, yBot);
AColor::Line(dc, xLeft + width - xFlat, yBot, xLeft, yBot - leftTaper);
@ -2030,12 +2085,12 @@ void TrackArtist::DrawTimeSlider(wxDC & dc,
int yy;
int i;
AColor::Light(&dc, false);
AColor::Light(&dc, false, highlight);
for (i = 0;i < nBars; i++) {
yy = firstBar + barSpacing * i;
AColor::Line(dc, xLeft, yy, xLeft + barWidth, yy);
}
AColor::Dark(&dc, false);
AColor::Dark(&dc, false, highlight);
for(i = 0;i < nBars; i++){
yy = firstBar + barSpacing * i + 1;
AColor::Line(dc, xLeft, yy, xLeft + barWidth, yy);

View File

@ -133,7 +133,7 @@ class AUDACITY_DLL_API TrackArtist {
const wxRect & rect, const ZoomInfo &zoomInfo);
void DrawTimeSlider(wxDC & dc, const wxRect & rect,
bool rightwards);
bool rightwards, bool highlight);
void DrawClipWaveform(TrackPanelDrawingContext &context,
const WaveTrack *track, const WaveClip *clip,
@ -154,7 +154,8 @@ class AUDACITY_DLL_API TrackArtist {
int zeroLevelYCoordinate,
bool dB, float dBRange,
double t0, double t1, const ZoomInfo &zoomInfo,
bool drawEnvelope, bool bIsSyncLockSelected);
bool drawEnvelope, bool bIsSyncLockSelected,
bool highlightEnvelope);
void DrawMinMaxRMS(wxDC &dc, const wxRect & rect, const double env[],
float zoomMin, float zoomMax,
bool dB, float dBRange,
@ -169,13 +170,14 @@ class AUDACITY_DLL_API TrackArtist {
bool dB, float dBRange,
const WaveClip *clip,
const ZoomInfo &zoomInfo,
bool bigPoints, bool showPoints, bool muted);
bool bigPoints, bool showPoints, bool muted,
bool highlight);
void DrawNegativeOffsetTrackArrows(wxDC & dc, const wxRect & rect);
void DrawEnvelope(wxDC & dc, const wxRect & rect, const double env[],
float zoomMin, float zoomMax,
bool dB, float dBRange);
bool dB, float dBRange, bool highlight);
void DrawEnvLine(wxDC & dc, const wxRect & rect, int x0, int y0, int cy, bool top);
// Preference values

View File

@ -1648,12 +1648,14 @@ void TrackPanel::RefreshTrack(Track *trk, bool refreshbacking)
link = trk->GetLink();
}
// subtract insets and shadows from the rectangle, but not border
// This matters because some separators do paint over the border
wxRect rect(kLeftInset,
// So that the highlighting of the resizer refreshes,
// include left and right inset areas,
// exclude the inset above,
// but include the inset below.
wxRect rect(0,
-mViewInfo->vpos + trk->GetY() + kTopInset,
GetRect().GetWidth() - kLeftInset - kRightInset - kShadowThickness,
trk->GetHeight() - kTopInset - kShadowThickness);
GetRect().GetWidth(),
trk->GetHeight() );
if (link) {
rect.height += link->GetHeight();
@ -1749,7 +1751,8 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
trackRect.height = 0; // for drawing background in no tracks case.
VisibleTrackIterator iter(GetProject());
for (Track *t = iter.First(); t; t = iter.Next()) {
Track *prev{};
for (Track *t = iter.First(); t; prev = t, t = iter.Next()) {
trackRect.y = t->GetY() - mViewInfo->vpos;
trackRect.height = t->GetHeight();
@ -1793,7 +1796,7 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
if (mAx->IsFocused(t)) {
focusRect = borderRect;
}
DrawOutside(context, borderTrack, borderRect);
DrawOutside(context, borderTrack, prev, borderRect);
}
// Believe it or not, we can speed up redrawing if we don't
@ -1835,7 +1838,7 @@ void TrackPanel::DrawEverythingElse(TrackPanelDrawingContext &context,
mUIHandle->DrawExtras(UIHandle::Cells, dc, region, clip);
// Paint over the part below the tracks
trackRect.y += trackRect.height;
trackRect.y += trackRect.height + kTopInset;
if (trackRect.y < clip.GetBottom()) {
AColor::TrackPanelBackground(dc, false);
dc->DrawRectangle(trackRect.x,
@ -2291,7 +2294,7 @@ void TrackInfo::Status2DrawFunction
void TrackPanel::DrawOutside
(TrackPanelDrawingContext &context,
Track * t, const wxRect & rec)
Track * t, Track *prev, const wxRect & rec)
{
auto dc = &context.dc;
bool bIsWave = (t->GetKind() == Track::Wave);
@ -2300,7 +2303,7 @@ void TrackPanel::DrawOutside
{
// Start with whole track rect
wxRect rect = rec;
DrawOutsideOfTrack(context, t, rect);
DrawOutsideOfTrack(context, t, prev, rect);
// Now exclude left, right, and top insets
rect.x += kLeftInset;
@ -2342,7 +2345,7 @@ void TrackPanel::DrawOutside
// If linked to a following channel, also paint the separator area, which
// overlaps the next track rectangle's top
void TrackPanel::DrawOutsideOfTrack
(TrackPanelDrawingContext &context, Track * t, const wxRect & rect)
(TrackPanelDrawingContext &context, Track * t, Track *prev, const wxRect & rect)
{
auto dc = &context.dc;
@ -2355,10 +2358,13 @@ void TrackPanel::DrawOutsideOfTrack
side.width = kLeftInset;
dc->DrawRectangle(side);
// Area between panel border and top track border
side = rect;
side.height = kTopInset;
dc->DrawRectangle(side);
if (!prev)
{
// Area above the first track
side = rect;
side.height = kTopInset;
dc->DrawRectangle(side);
}
// Area between panel border and right track border
side = rect;
@ -2366,17 +2372,32 @@ void TrackPanel::DrawOutsideOfTrack
side.width = kTopInset;
dc->DrawRectangle(side);
// Area between tracks of stereo group
if (t->GetLinked()
auto target = dynamic_cast<TrackPanelResizeHandle*>(context.target.get());
auto highlight = target && target->GetTrack().get() == t;
side = rect;
side.y += t->GetHeight();
// Area below the track
if (highlight ||
t->GetLinked()
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|| MONO_WAVE_PAN(t)
#endif
) {
// Paint the channel separator over (what would be) the shadow of the top
// channel, and the top inset of the bottom channel
side = rect;
side.y += t->GetHeight() - kShadowThickness;
// (Or, highlight the resizer area below the track)
side.y -= kShadowThickness;
side.height = kTopInset + kShadowThickness;
if (highlight)
dc->SetBrush( AColor::uglyBrush );
dc->DrawRectangle(side);
}
else
{
side.height = kTopInset;
dc->DrawRectangle(side);
}
}

View File

@ -417,14 +417,14 @@ protected:
const wxRect & clip);
void DrawOutside
(TrackPanelDrawingContext &context,
Track *t, const wxRect & rec);
Track *t, Track *prev, const wxRect & rec);
void HighlightFocusedTrack (wxDC* dc, const wxRect &rect);
void DrawShadow (Track *t, wxDC* dc, const wxRect & rect);
void DrawBordersAroundTrack(Track *t, wxDC* dc, const wxRect & rect, const int labelw, const int vrul);
void DrawOutsideOfTrack
(TrackPanelDrawingContext &context,
Track *t, const wxRect & rect);
Track *t, Track *prev, const wxRect & rect);
public:
// Set the object that performs catch-all event handling when the pointer

View File

@ -67,6 +67,8 @@ TrackPanelResizeHandle::TrackPanelResizeHandle
: mpTrack{ track }
, mMouseClickY( y )
{
mChangeHighlight = RefreshCode::RefreshCell;
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
if (MONO_WAVE_PAN(track)){
//STM: Determine whether we should rescale one or two tracks

View File

@ -36,4 +36,19 @@ struct WaveTrackLocation {
int clipidx2; // second clip (right one)
};
inline
bool operator == (const WaveTrackLocation &a, const WaveTrackLocation &b)
{
return a.pos == b.pos &&
a.typ == b.typ &&
a.clipidx1 == b.clipidx1 &&
a.clipidx2 == b.clipidx2;
}
inline
bool operator != (const WaveTrackLocation &a, const WaveTrackLocation &b)
{
return !( a == b );
}
#endif

View File

@ -10,6 +10,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../../Audacity.h"
#include "LabelTextHandle.h"
#include "../../Experimental.h"
#include "../../../HitTestResult.h"
#include "../../../LabelTrack.h"
#include "../../../Project.h"
@ -22,7 +23,11 @@ LabelTextHandle::LabelTextHandle
( const std::shared_ptr<LabelTrack> &pLT, int labelNum )
: mpLT{ pLT }
, mLabelNum{ labelNum }
{}
{
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
mChangeHighlight = RefreshCode::RefreshCell;
#endif
}
HitTestPreview LabelTextHandle::HitPreview()
{

View File

@ -10,6 +10,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../../../Audacity.h"
#include "NoteTrackVZoomHandle.h"
#include "../../../../Experimental.h"
#include "NoteTrackVRulerControls.h"
#include "../../../../HitTestResult.h"
@ -38,7 +39,11 @@ NoteTrackVZoomHandle::NoteTrackVZoomHandle
(const std::shared_ptr<NoteTrack> &pTrack, const wxRect &rect, int y)
: mZoomStart(y), mZoomEnd(y), mRect(rect)
, mpTrack{ pTrack }
{}
{
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
mChangeHighlight = RefreshCode::RefreshCell;
#endif
}
HitTestPreview NoteTrackVZoomHandle::HitPreview(const wxMouseState &state)
{

View File

@ -10,6 +10,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../../../Audacity.h"
#include "CutlineHandle.h"
#include "../../../../Experimental.h"
#include "../../../../MemoryX.h"
@ -26,7 +27,11 @@ CutlineHandle::CutlineHandle
( const std::shared_ptr<WaveTrack> &pTrack, WaveTrackLocation location )
: mpTrack{ pTrack }
, mLocation{ location }
{}
{
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
mChangeHighlight = RefreshCode::RefreshCell;
#endif
}
HitTestPreview CutlineHandle::HitPreview(bool cutline, bool unsafe)
{

View File

@ -10,6 +10,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../../../Audacity.h"
#include "SampleHandle.h"
#include "../../Experimental.h"
#include <algorithm>
#include "../../../../MemoryX.h"
@ -36,7 +37,11 @@ static const double SMOOTHING_PROPORTION_MIN = 0.0;
SampleHandle::SampleHandle( const std::shared_ptr<WaveTrack> &pTrack )
: mClickedTrack{ pTrack }
{}
{
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
mChangeHighlight = RefreshCode::RefreshCell;
#endif
}
HitTestPreview SampleHandle::HitPreview
(const wxMouseState &state, const AudacityProject *pProject, bool unsafe)

View File

@ -10,6 +10,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../../../Audacity.h"
#include "WaveTrackVZoomHandle.h"
#include "../../../../Experimental.h"
#include "WaveTrackVRulerControls.h"
#include "../../../../HitTestResult.h"
@ -47,7 +48,9 @@ WaveTrackVZoomHandle::WaveTrackVZoomHandle
(const std::shared_ptr<WaveTrack> &pTrack, const wxRect &rect, int y)
: mZoomStart(y), mZoomEnd(y), mRect(rect)
, mpTrack{ pTrack }
{}
{
mChangeHighlight = RefreshCode::RefreshCell;
}
void WaveTrackVZoomHandle::DoZoom
(AudacityProject *pProject,

View File

@ -10,6 +10,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../Audacity.h"
#include "EnvelopeHandle.h"
#include "../../Experimental.h"
#include "../../MemoryX.h"
@ -28,12 +29,17 @@ Paul Licameli split from TrackPanel.cpp
EnvelopeHandle::EnvelopeHandle( Envelope *pEnvelope )
: mEnvelope{ pEnvelope }
{}
{
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
mChangeHighlight = RefreshCode::RefreshCell;
#endif
}
EnvelopeHandle::~EnvelopeHandle()
{}
HitTestPreview EnvelopeHandle::HitPreview(const AudacityProject *pProject, bool unsafe)
HitTestPreview EnvelopeHandle::HitPreview
(const AudacityProject *pProject, bool unsafe)
{
static auto disabledCursor =
::MakeCursor(wxCURSOR_NO_ENTRY, DisabledCursorXpm, 16, 16);

View File

@ -28,7 +28,8 @@ class EnvelopeHandle final : public UIHandle
{
EnvelopeHandle(const EnvelopeHandle&) = delete;
EnvelopeHandle &operator=(const EnvelopeHandle&) = delete;
static HitTestPreview HitPreview(const AudacityProject *pProject, bool unsafe);
static HitTestPreview HitPreview
(const AudacityProject *pProject, bool unsafe);
static UIHandlePtr HitEnvelope
(std::weak_ptr<EnvelopeHandle> &holder,

View File

@ -10,6 +10,7 @@ Paul Licameli split from TrackPanel.cpp
#include "../../Audacity.h"
#include "TimeShiftHandle.h"
#include "../../Experimental.h"
#include "TrackControls.h"
#include "../../AColor.h"
@ -27,7 +28,11 @@ TimeShiftHandle::TimeShiftHandle
( const std::shared_ptr<Track> &pTrack, bool gripHit )
: mCapturedTrack{ pTrack }
, mGripHit{ gripHit }
{}
{
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
mChangeHighlight = RefreshCode::RefreshCell;
#endif
}
HitTestPreview TimeShiftHandle::HitPreview
(const AudacityProject *pProject, bool unsafe)