Audacity 3.2.0
Classes | Namespaces | Functions | Variables
SpectrumView.cpp File Reference
#include "SpectrumView.h"
#include "SpectralDataManager.h"
#include "SpectrumCache.h"
#include "Sequence.h"
#include "Spectrum.h"
#include "SpectrumVRulerControls.h"
#include "WaveTrackView.h"
#include "WaveTrackViewConstants.h"
#include "../../../ui/BrushHandle.h"
#include "AColor.h"
#include "Prefs.h"
#include "NumberScale.h"
#include "../../../../TrackArt.h"
#include "../../../../TrackArtist.h"
#include "../../../../TrackPanelDrawingContext.h"
#include "ViewInfo.h"
#include "WaveClip.h"
#include "WaveTrack.h"
#include "../../../../prefs/SpectrogramSettings.h"
#include "../../../../ProjectSettings.h"
#include "SampleTrackCache.h"
#include "WaveTrackLocation.h"
#include <wx/dcmemory.h>
#include <wx/graphics.h>
#include "float_cast.h"
#include "WaveTrackControls.h"
#include "AudioIOBase.h"
#include "../../../../Menus.h"
#include "ProjectHistory.h"
#include "../../../../RefreshCode.h"
#include "../../../../prefs/PrefsDialog.h"
#include "../../../../prefs/SpectrumPrefs.h"
#include "AudacityMessageBox.h"
#include "../../../../widgets/PopupMenuTable.h"
Include dependency graph for SpectrumView.cpp:

Go to the source code of this file.


class  SpectrumView::SpectralDataSaver
struct  anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler


namespace  anonymous_namespace{SpectrumView.cpp}


static UIHandlePtr BrushHandleHitTest (std::weak_ptr< BrushHandle > &holder, const TrackPanelMouseState &st, const AudacityProject *pProject, const std::shared_ptr< SpectrumView > &pTrackView, const std::shared_ptr< SpectralData > &mpData)
static float anonymous_namespace{SpectrumView.cpp}::findValue (const float *spectrum, float bin0, float bin1, unsigned nBins, bool autocorrelation, int gain, int range)
AColor::ColorGradientChoice anonymous_namespace{SpectrumView.cpp}::ChooseColorSet (float bin0, float bin1, float selBinLo, float selBinCenter, float selBinHi, int dashCount, bool isSpectral)
void anonymous_namespace{SpectrumView.cpp}::DrawClipSpectrum (TrackPanelDrawingContext &context, SampleTrackCache &waveTrackCache, const WaveClip *clip, const wxRect &rect, const std::shared_ptr< SpectralData > &mpSpectralData, bool selected)
static bool ShouldCaptureEvent (wxKeyEvent &event, SpectralData *pData)


static WaveTrackSubView::Type sType
static WaveTrackSubViewType::RegisteredType reg { sType }
static const WaveTrackSubViews::RegisteredFactory key
PopupMenuTable::AttachedItem anonymous_namespace{SpectrumView.cpp}::sAttachment

Function Documentation

◆ BrushHandleHitTest()

static UIHandlePtr BrushHandleHitTest ( std::weak_ptr< BrushHandle > &  holder,
const TrackPanelMouseState st,
const AudacityProject pProject,
const std::shared_ptr< SpectrumView > &  pTrackView,
const std::shared_ptr< SpectralData > &  mpData 

Definition at line 123 of file SpectrumView.cpp.

129 const auto &viewInfo = ViewInfo::Get( *pProject );
130 auto &projectSettings = ProjectSettings::Get( *pProject );
131 auto result = std::make_shared<BrushHandle>(
132 std::make_shared<SpectrumView::SpectralDataSaver>(*pTrackView),
133 pTrackView, TrackList::Get( *pProject ),
134 st, viewInfo, mpData, projectSettings);
136 result = AssignUIHandlePtr(holder, result);
138 //Make sure we are within the selected track
139 // Adjusting the selection edges can be turned off in
140 // the preferences...
141 auto pTrack = pTrackView->FindTrack();
142 if (!pTrack->GetSelected() || !viewInfo.bAdjustSelectionEdges)
143 {
144 return result;
145 }
147 return result;
std::shared_ptr< Subclass > AssignUIHandlePtr(std::weak_ptr< Subclass > &holder, const std::shared_ptr< Subclass > &pNew)
Definition: UIHandle.h:151
static ProjectSettings & Get(AudacityProject &project)
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:487
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References AssignUIHandlePtr(), ViewInfo::Get(), TrackList::Get(), and ProjectSettings::Get().

Referenced by SpectrumView::DetailedHitTest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShouldCaptureEvent()

static bool ShouldCaptureEvent ( wxKeyEvent &  event,
SpectralData pData 

Definition at line 1055 of file SpectrumView.cpp.

1057 const auto keyCode = event.GetKeyCode();
1058 return
1059 (keyCode == WXK_BACK || keyCode == WXK_DELETE ||
1060 keyCode == WXK_NUMPAD_DELETE)
1061 && pData && !pData->dataHistory.empty();
std::vector< HopsAndBinsMap > dataHistory
Definition: SpectrumView.h:44

References SpectralData::dataHistory.

Referenced by SpectrumView::CaptureKey(), SpectrumView::Char(), and SpectrumView::KeyDown().

Here is the caller graph for this function:

Variable Documentation

◆ key

Initial value:
[]( WaveTrackView &view ){
return std::make_shared< SpectrumView >( view );

Definition at line 914 of file SpectrumView.cpp.

◆ reg

Definition at line 53 of file SpectrumView.cpp.

◆ sType

WaveTrackSubView::Type sType
Initial value:
{ wxT("Spectrogram"), XXO("&Spectrogram") }
XXO("&Cut/Copy/Paste Toolbar")

Definition at line 48 of file SpectrumView.cpp.

Referenced by SpectrumView::SubViewType().