mirror of
https://github.com/cookiengineer/audacity
synced 2025-09-04 14:48:40 +02:00
Bold, clickable, butting clip boundaries also in spectrum view
This commit is contained in:
parent
97b7572504
commit
9e0372cbea
@ -44,7 +44,7 @@ std::vector<UIHandlePtr> SpectrumView::DetailedHitTest(
|
||||
const auto wt = std::static_pointer_cast< WaveTrack >( FindTrack() );
|
||||
|
||||
return WaveTrackSubView::DoDetailedHitTest(
|
||||
state, pProject, currentTool, bMultiTool, wt, *this
|
||||
state, pProject, currentTool, bMultiTool, wt
|
||||
).second;
|
||||
}
|
||||
|
||||
@ -621,6 +621,8 @@ void SpectrumView::DoDraw( TrackPanelDrawingContext &context,
|
||||
WaveTrackCache cache(track->SharedPointer<const WaveTrack>());
|
||||
for (const auto &clip: track->GetClips())
|
||||
DrawClipSpectrum( context, cache, clip.get(), rect );
|
||||
|
||||
DrawBoldBoundaries( context, track, rect );
|
||||
}
|
||||
|
||||
void SpectrumView::Draw(
|
||||
|
@ -10,6 +10,8 @@ Paul Licameli split from TrackPanel.cpp
|
||||
|
||||
#include "WaveTrackView.h"
|
||||
|
||||
#include "CutlineHandle.h"
|
||||
|
||||
#include "../../../../Experimental.h"
|
||||
|
||||
#include <numeric>
|
||||
@ -423,11 +425,10 @@ std::pair<
|
||||
> WaveTrackSubView::DoDetailedHitTest(
|
||||
const TrackPanelMouseState &state,
|
||||
const AudacityProject *pProject, int currentTool, bool bMultiTool,
|
||||
const std::shared_ptr<WaveTrack> &wt,
|
||||
CommonTrackView &view)
|
||||
const std::shared_ptr<WaveTrack> &wt)
|
||||
{
|
||||
auto results = WaveTrackView::DoDetailedHitTest(
|
||||
state, pProject, currentTool, bMultiTool, wt, view );
|
||||
state, pProject, currentTool, bMultiTool, wt, *this );
|
||||
if ( results.first )
|
||||
return results;
|
||||
|
||||
@ -438,10 +439,60 @@ std::pair<
|
||||
if (pHandle)
|
||||
results.second.push_back( pHandle );
|
||||
}
|
||||
if (auto result = CutlineHandle::HitTest(
|
||||
mCutlineHandle, state.state, state.rect,
|
||||
pProject, wt ))
|
||||
// This overriding test applies in all tools
|
||||
results.second.push_back(result);
|
||||
|
||||
return results;
|
||||
}
|
||||
|
||||
|
||||
void WaveTrackSubView::DrawBoldBoundaries(
|
||||
TrackPanelDrawingContext &context, const WaveTrack *track,
|
||||
const wxRect &rect )
|
||||
{
|
||||
auto &dc = context.dc;
|
||||
const auto artist = TrackArtist::Get( context );
|
||||
|
||||
// Update cache for locations, e.g. cutlines and merge points
|
||||
track->UpdateLocationsCache();
|
||||
|
||||
const auto &zoomInfo = *artist->pZoomInfo;
|
||||
|
||||
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
|
||||
auto target2 = dynamic_cast<CutlineHandle*>(context.target.get());
|
||||
#endif
|
||||
for (const auto loc : track->GetCachedLocations()) {
|
||||
bool highlightLoc = false;
|
||||
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
|
||||
highlightLoc =
|
||||
target2 && target2->GetTrack().get() == track &&
|
||||
target2->GetLocation() == loc;
|
||||
#endif
|
||||
const int xx = zoomInfo.TimeToPosition(loc.pos);
|
||||
if (xx >= 0 && xx < rect.width) {
|
||||
dc.SetPen( highlightLoc ? 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( highlightLoc ? AColor::uglyPen : *wxRED_PEN );
|
||||
}
|
||||
else {
|
||||
#ifdef EXPERIMENTAL_DA
|
||||
// JKC Black does not show up enough.
|
||||
dc.SetPen(highlightLoc ? AColor::uglyPen : *wxWHITE_PEN);
|
||||
#else
|
||||
dc.SetPen(highlightLoc ? AColor::uglyPen : *wxBLACK_PEN);
|
||||
#endif
|
||||
}
|
||||
AColor::Line(dc, (int) (rect.x + xx), rect.y, (int) (rect.x + xx), rect.y + rect.height);
|
||||
dc.SetPen( highlightLoc ? AColor::uglyPen : *wxGREY_PEN );
|
||||
AColor::Line(dc, (int) (rect.x + xx + 1), rect.y, (int) (rect.x + xx + 1), rect.y + rect.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WaveTrackView &WaveTrackView::Get( WaveTrack &track )
|
||||
{
|
||||
return static_cast< WaveTrackView& >( TrackView::Get( track ) );
|
||||
|
@ -15,6 +15,7 @@ Paul Licameli split from class WaveTrack
|
||||
#include "../../../../ClientData.h"
|
||||
namespace WaveTrackViewConstants{ enum Display : int; }
|
||||
|
||||
class CutlineHandle;
|
||||
class WaveTrack;
|
||||
class WaveTrackView;
|
||||
|
||||
@ -32,11 +33,17 @@ public:
|
||||
> DoDetailedHitTest(
|
||||
const TrackPanelMouseState &state,
|
||||
const AudacityProject *pProject, int currentTool, bool bMultiTool,
|
||||
const std::shared_ptr<WaveTrack> &wt,
|
||||
CommonTrackView &view);
|
||||
const std::shared_ptr<WaveTrack> &wt );
|
||||
|
||||
protected:
|
||||
static void DrawBoldBoundaries(
|
||||
TrackPanelDrawingContext &context, const WaveTrack *track,
|
||||
const wxRect &rect );
|
||||
|
||||
private:
|
||||
std::weak_ptr<CutlineHandle> mCutlineHandle;
|
||||
std::weak_ptr<WaveTrackView> mwWaveTrackView;
|
||||
};
|
||||
};
|
||||
|
||||
struct WaveTrackSubViewPlacement {
|
||||
int index;
|
||||
|
@ -17,7 +17,6 @@ Paul Licameli split from WaveTrackView.cpp
|
||||
#include "WaveTrackView.h"
|
||||
#include "WaveTrackViewConstants.h"
|
||||
|
||||
#include "CutlineHandle.h"
|
||||
#include "SampleHandle.h"
|
||||
#include "../../../ui/EnvelopeHandle.h"
|
||||
#include "../../../ui/TimeShiftHandle.h"
|
||||
@ -43,24 +42,17 @@ std::vector<UIHandlePtr> WaveformView::DetailedHitTest(
|
||||
const TrackPanelMouseState &st,
|
||||
const AudacityProject *pProject, int currentTool, bool bMultiTool )
|
||||
{
|
||||
const auto wt = std::static_pointer_cast< WaveTrack >( FindTrack() );
|
||||
|
||||
auto &view = *this;
|
||||
const auto pTrack =
|
||||
std::static_pointer_cast< WaveTrack >( view.FindTrack() );
|
||||
|
||||
auto pair = WaveTrackSubView::DoDetailedHitTest(
|
||||
st, pProject, currentTool, bMultiTool, wt, view);
|
||||
st, pProject, currentTool, bMultiTool, pTrack);
|
||||
auto &results = pair.second;
|
||||
|
||||
if (!pair.first) {
|
||||
const auto pTrack =
|
||||
std::static_pointer_cast< WaveTrack >( view.FindTrack() );
|
||||
UIHandlePtr result;
|
||||
|
||||
if (NULL != (result = CutlineHandle::HitTest(
|
||||
view.mCutlineHandle, st.state, st.rect,
|
||||
pProject, pTrack )))
|
||||
// This overriding test applies in all tools
|
||||
results.push_back(result);
|
||||
if (bMultiTool) {
|
||||
// Conditional hit tests
|
||||
// If Tools toolbar were eliminated, we would keep these
|
||||
@ -966,9 +958,8 @@ void DrawTimeSlider( TrackPanelDrawingContext &context,
|
||||
|
||||
}
|
||||
|
||||
// Headers needed only for experimental drawing below
|
||||
// Header needed only for experimental drawing below
|
||||
//#include "tracks/ui/TimeShiftHandle.h"
|
||||
//#include "tracks/playabletrack/wavetrack/ui/CutlineHandle.h"
|
||||
void WaveformView::DoDraw(TrackPanelDrawingContext &context,
|
||||
const WaveTrack *track,
|
||||
const wxRect & rect,
|
||||
@ -996,41 +987,7 @@ void WaveformView::DoDraw(TrackPanelDrawingContext &context,
|
||||
DrawClipWaveform(context, track, clip.get(), rect,
|
||||
dB, muted);
|
||||
|
||||
// Update cache for locations, e.g. cutlines and merge points
|
||||
track->UpdateLocationsCache();
|
||||
|
||||
const auto &zoomInfo = *artist->pZoomInfo;
|
||||
|
||||
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
|
||||
auto target2 = dynamic_cast<CutlineHandle*>(context.target.get());
|
||||
#endif
|
||||
for (const auto loc : track->GetCachedLocations()) {
|
||||
bool highlightLoc = false;
|
||||
#ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
|
||||
highlightLoc =
|
||||
target2 && target2->GetTrack().get() == track &&
|
||||
target2->GetLocation() == loc;
|
||||
#endif
|
||||
const int xx = zoomInfo.TimeToPosition(loc.pos);
|
||||
if (xx >= 0 && xx < rect.width) {
|
||||
dc.SetPen( highlightLoc ? 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( highlightLoc ? AColor::uglyPen : *wxRED_PEN );
|
||||
}
|
||||
else {
|
||||
#ifdef EXPERIMENTAL_DA
|
||||
// JKC Black does not show up enough.
|
||||
dc.SetPen(highlightLoc ? AColor::uglyPen : *wxWHITE_PEN);
|
||||
#else
|
||||
dc.SetPen(highlightLoc ? AColor::uglyPen : *wxBLACK_PEN);
|
||||
#endif
|
||||
}
|
||||
AColor::Line(dc, (int) (rect.x + xx), rect.y, (int) (rect.x + xx), rect.y + rect.height);
|
||||
dc.SetPen( highlightLoc ? AColor::uglyPen : *wxGREY_PEN );
|
||||
AColor::Line(dc, (int) (rect.x + xx + 1), rect.y, (int) (rect.x + xx + 1), rect.y + rect.height);
|
||||
}
|
||||
}
|
||||
DrawBoldBoundaries( context, track, rect );
|
||||
|
||||
const auto drawSliders = artist->drawSliders;
|
||||
if (drawSliders) {
|
||||
|
@ -14,7 +14,6 @@ Paul Licameli split from WaveTrackView.h
|
||||
#include "WaveTrackView.h" // to inherit
|
||||
|
||||
class WaveTrack;
|
||||
class CutlineHandle;
|
||||
class SampleHandle;
|
||||
class EnvelopeHandle;
|
||||
|
||||
@ -50,7 +49,6 @@ private:
|
||||
protected:
|
||||
void DoSetMinimized( bool minimized ) override;
|
||||
|
||||
std::weak_ptr<CutlineHandle> mCutlineHandle;
|
||||
std::weak_ptr<SampleHandle> mSampleHandle;
|
||||
std::weak_ptr<EnvelopeHandle> mEnvelopeHandle;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user