Audacity  2.2.2
WaveTrackVZoomHandle.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3 Audacity: A Digital Audio Editor
4 
5 WaveTrackVZoomHandle.cpp
6 
7 Paul Licameli split from TrackPanel.cpp
8 
9 **********************************************************************/
10 
11 #include "../../../../Audacity.h"
12 #include "WaveTrackVZoomHandle.h"
13 #include "../../../../Experimental.h"
15 
16 #include "../../../../HitTestResult.h"
17 #include "../../../../NumberScale.h"
18 #include "../../../../prefs/SpectrogramSettings.h"
19 #include "../../../../prefs/WaveformSettings.h"
20 #include "../../../../Project.h"
21 #include "../../../../RefreshCode.h"
22 #include "../../../../TrackPanelMouseEvent.h"
23 #include "../../../../WaveTrack.h"
24 #include "../../../../widgets/PopupMenuTable.h"
25 #include "../../../../../images/Cursors.h"
26 #include "../../../../Prefs.h"
27 
28 namespace
29 {
30 
31 struct InitMenuData
32 {
33 public:
34  WaveTrack *pTrack;
35  wxRect rect;
36  unsigned result;
37  int yy;
38 };
39 
40 bool IsDragZooming(int zoomStart, int zoomEnd)
41 {
42  const int DragThreshold = 3;// Anything over 3 pixels is a drag, else a click.
43  bool bVZoom;
44  gPrefs->Read(wxT("/GUI/VerticalZooming"), &bVZoom, false);
45  return bVZoom && (abs(zoomEnd - zoomStart) > DragThreshold);
46 }
47 
48 }
49 
51 (const std::shared_ptr<WaveTrack> &pTrack, const wxRect &rect, int y)
52  : mpTrack{ pTrack } , mZoomStart(y), mZoomEnd(y), mRect(rect)
53 {
54 }
55 
57 {
58 #ifdef EXPERIMENTAL_TRACK_PANEL_HIGHLIGHTING
60 #endif
61 }
62 
63 // ZoomKind says how to zoom.
64 // If ZoomStart and ZoomEnd are not equal, this may override
65 // the zoomKind and cause a drag-zoom-in.
67  (AudacityProject *pProject,
68  WaveTrack *pTrack, WaveTrack *partner, int ZoomKind,
69  const wxRect &rect, int zoomStart, int zoomEnd,
70  bool fixedMousePoint)
71 {
72  static const float ZOOMLIMIT = 0.001f;
73  int height = rect.height;
74  int ypos = rect.y;
75 
76  // Ensure start and end are in order (swap if not).
77  if (zoomEnd < zoomStart)
78  std::swap( zoomStart, zoomEnd );
79 
80  float min, max, c, minBand = 0;
81  const double rate = pTrack->GetRate();
82  const float halfrate = rate / 2;
83  float maxFreq = 8000.0;
84  const SpectrogramSettings &settings = pTrack->GetSpectrogramSettings();
85  NumberScale scale;
86  const bool spectral = (pTrack->GetDisplay() == WaveTrack::Spectrum);
87  const bool spectrumLinear = spectral &&
89 
90 
91  bool bDragZoom = IsDragZooming(zoomStart, zoomEnd);
92  // Add 100 if spectral to separate the kinds of zoom.
93  const int kSpectral = 100;
94 
95  // Possibly override the zoom kind.
96  if( bDragZoom )
97  ZoomKind = kZoomInByDrag;
98 
99  // If we are actually zooming a spectrum rather than a wave.
100  ZoomKind += spectral ? kSpectral:0;
101 
102  float top=2.0;
103  float half=0.5;
104 
105  if (spectral) {
106  pTrack->GetSpectrumBounds(&min, &max);
107  scale = (settings.GetScale(min, max));
108  const auto fftLength = settings.GetFFTLength();
109  const float binSize = rate / fftLength;
110  maxFreq = gPrefs->Read(wxT("/Spectrum/MaxFreq"), 8000L);
111  // JKC: Following discussions of Bug 1208 I'm allowing zooming in
112  // down to one bin.
113  // const int minBins =
114  // std::min(10, fftLength / 2); //minimum 10 freq bins, unless there are less
115  const int minBins = 1;
116  minBand = minBins * binSize;
117  }
118  else{
119  pTrack->GetDisplayBounds(&min, &max);
120  const WaveformSettings &settings = pTrack->GetWaveformSettings();
121  const bool linear = settings.isLinear();
122  if( !linear ){
123  top = (LINEAR_TO_DB(2.0) + settings.dBRange) / settings.dBRange;
124  half = (LINEAR_TO_DB(0.5) + settings.dBRange) / settings.dBRange;
125  }
126  }
127 
128 
129  // Compute min and max.
130  switch(ZoomKind)
131  {
132  default:
133  // If we have covered all the cases, this won't happen.
134  // In release builds Audacity will ignore the zoom.
135  wxFAIL_MSG("Zooming Case not implemented by Audacity");
136  break;
137  case kZoomReset:
138  case kZoom1to1:
139  {
140  // Zoom out full
141  min = -1.0;
142  max = 1.0;
143  }
144  break;
145  case kZoomDiv2:
146  {
147  // Zoom out even more than full :-)
148  // -2.0..+2.0 (or logarithmic equivalent)
149  min = -top;
150  max = top;
151  }
152  break;
153  case kZoomTimes2:
154  {
155  // Zoom in to -0.5..+0.5
156  min = -half;
157  max = half;
158  }
159  break;
160  case kZoomHalfWave:
161  {
162  // Zoom to show fractionally more than the top half of the wave.
163  min = -0.01f;
164  max = 1.0;
165  }
166  break;
167  case kZoomInByDrag:
168  {
169  const float tmin = min, tmax = max;
170  const float p1 = (zoomStart - ypos) / (float)height;
171  const float p2 = (zoomEnd - ypos) / (float)height;
172  max = (tmax * (1.0 - p1) + tmin * p1);
173  min = (tmax * (1.0 - p2) + tmin * p2);
174 
175  // Waveform view - allow zooming down to a range of ZOOMLIMIT
176  if (max - min < ZOOMLIMIT) { // if user attempts to go smaller...
177  c = (min + max) / 2; // ...set centre of view to centre of dragged area and top/bottom to ZOOMLIMIT/2 above/below
178  min = c - ZOOMLIMIT / 2.0;
179  max = c + ZOOMLIMIT / 2.0;
180  }
181  }
182  break;
183  case kZoomIn:
184  {
185  // Enforce maximum vertical zoom
186  const float oldRange = max - min;
187  const float l = std::max(ZOOMLIMIT, 0.5f * oldRange);
188  const float ratio = l / (max - min);
189 
190  const float p1 = (zoomStart - ypos) / (float)height;
191  float c = (max * (1.0 - p1) + min * p1);
192  if (fixedMousePoint)
193  min = c - ratio * (1.0f - p1) * oldRange,
194  max = c + ratio * p1 * oldRange;
195  else
196  min = c - 0.5 * l,
197  max = c + 0.5 * l;
198  }
199  break;
200  case kZoomOut:
201  {
202  // Zoom out
203  if (min <= -1.0 && max >= 1.0) {
204  min = -top;
205  max = top;
206  }
207  else {
208  // limit to +/- 1 range unless already outside that range...
209  float minRange = (min < -1) ? -top : -1.0;
210  float maxRange = (max > 1) ? top : 1.0;
211  // and enforce vertical zoom limits.
212  const float p1 = (zoomStart - ypos) / (float)height;
213  if (fixedMousePoint) {
214  const float oldRange = max - min;
215  const float c = (max * (1.0 - p1) + min * p1);
216  min = std::min(maxRange - ZOOMLIMIT,
217  std::max(minRange, c - 2 * (1.0f - p1) * oldRange));
218  max = std::max(minRange + ZOOMLIMIT,
219  std::min(maxRange, c + 2 * p1 * oldRange));
220  }
221  else {
222  const float c = p1 * min + (1 - p1) * max;
223  const float l = (max - min);
224  min = std::min(maxRange - ZOOMLIMIT,
225  std::max(minRange, c - l));
226  max = std::max(minRange + ZOOMLIMIT,
227  std::min(maxRange, c + l));
228  }
229  }
230  }
231  break;
232 
233  // VZooming on spectral we don't implement the other zoom presets.
234  // They are also not in the menu.
235  case kZoomReset + kSpectral:
236  {
237  // Zoom out to normal level.
238  min = spectrumLinear ? 0.0f : 1.0f;
239  max = maxFreq;
240  }
241  break;
242  case kZoom1to1 + kSpectral:
243  case kZoomDiv2 + kSpectral:
244  case kZoomTimes2 + kSpectral:
245  case kZoomHalfWave + kSpectral:
246  {
247  // Zoom out full
248  min = spectrumLinear ? 0.0f : 1.0f;
249  max = halfrate;
250  }
251  break;
252  case kZoomInByDrag + kSpectral:
253  {
254  double xmin = 1 - (zoomEnd - ypos) / (float)height;
255  double xmax = 1 - (zoomStart - ypos) / (float)height;
256  const float middle = (xmin + xmax) / 2;
257  const float middleValue = scale.PositionToValue(middle);
258 
259  min = std::max(spectrumLinear ? 0.0f : 1.0f,
260  std::min(middleValue - minBand / 2,
261  scale.PositionToValue(xmin)
262  ));
263  max = std::min(halfrate,
264  std::max(middleValue + minBand / 2,
265  scale.PositionToValue(xmax)
266  ));
267  }
268  break;
269  case kZoomIn + kSpectral:
270  {
271  // Center the zoom-in at the click
272  const float p1 = (zoomStart - ypos) / (float)height;
273  const float middle = 1.0f - p1;
274  const float middleValue = scale.PositionToValue(middle);
275 
276  if (fixedMousePoint) {
277  min = std::max(spectrumLinear ? 0.0f : 1.0f,
278  std::min(middleValue - minBand * middle,
279  scale.PositionToValue(0.5f * middle)
280  ));
281  max = std::min(halfrate,
282  std::max(middleValue + minBand * p1,
283  scale.PositionToValue(middle + 0.5f * p1)
284  ));
285  }
286  else {
287  min = std::max(spectrumLinear ? 0.0f : 1.0f,
288  std::min(middleValue - minBand / 2,
289  scale.PositionToValue(middle - 0.25f)
290  ));
291  max = std::min(halfrate,
292  std::max(middleValue + minBand / 2,
293  scale.PositionToValue(middle + 0.25f)
294  ));
295  }
296  }
297  break;
298  case kZoomOut + kSpectral:
299  {
300  // Zoom out
301  const float p1 = (zoomStart - ypos) / (float)height;
302  // (Used to zoom out centered at midline, ignoring the click, if linear view.
303  // I think it is better to be consistent. PRL)
304  // Center zoom-out at the midline
305  const float middle = // spectrumLinear ? 0.5f :
306  1.0f - p1;
307 
308  if (fixedMousePoint) {
309  min = std::max(spectrumLinear ? 0.0f : 1.0f, scale.PositionToValue(-middle));
310  max = std::min(halfrate, scale.PositionToValue(1.0f + p1));
311  }
312  else {
313  min = std::max(spectrumLinear ? 0.0f : 1.0f, scale.PositionToValue(middle - 1.0f));
314  max = std::min(halfrate, scale.PositionToValue(middle + 1.0f));
315  }
316  }
317  break;
318  }
319 
320  // Now actually apply the zoom.
321  if (spectral) {
322  pTrack->SetSpectrumBounds(min, max);
323  if (partner)
324  partner->SetSpectrumBounds(min, max);
325  }
326  else {
327  pTrack->SetDisplayBounds(min, max);
328  if (partner)
329  partner->SetDisplayBounds(min, max);
330  }
331 
332  zoomEnd = zoomStart = 0;
333  if( pProject )
334  pProject->ModifyState(true);
335 }
336 
337 enum {
345 
346  // Reserve an ample block of ids for waveform scale types
349 
350  // Reserve an ample block of ids for spectrum scale types
353 };
354 
356 // Table class
357 
359 {
360 protected:
362 
363  void InitMenu(Menu *pMenu, void *pUserData) override;
364 
365 private:
366  void DestroyMenu() override
367  {
368  mpData = nullptr;
369  }
370 
371 protected:
372  InitMenuData *mpData {};
373 
374  void OnZoom( int iZoomCode );
375  void OnZoomFitVertical(wxCommandEvent&){ OnZoom( kZoom1to1 );};
376  void OnZoomReset(wxCommandEvent&){ OnZoom( kZoomReset );};
377  void OnZoomDiv2Vertical(wxCommandEvent&){ OnZoom( kZoomDiv2 );};
378  void OnZoomTimes2Vertical(wxCommandEvent&){ OnZoom( kZoomTimes2 );};
379  void OnZoomHalfWave(wxCommandEvent&){ OnZoom( kZoomHalfWave );};
380  void OnZoomInVertical(wxCommandEvent&){ OnZoom( kZoomIn );};
381  void OnZoomOutVertical(wxCommandEvent&){ OnZoom( kZoomOut );};
382 };
383 
384 void WaveTrackVRulerMenuTable::InitMenu(Menu *, void *pUserData)
385 {
386  mpData = static_cast<InitMenuData*>(pUserData);
387 }
388 
389 
390 void WaveTrackVRulerMenuTable::OnZoom( int iZoomCode )
391 {
392  // Assume linked track is wave or null
393  const auto partner = static_cast<WaveTrack *>(mpData->pTrack->GetLink());
395  (::GetActiveProject(), mpData->pTrack, partner,
396  iZoomCode, mpData->rect, mpData->yy, mpData->yy, false);
397 
398  using namespace RefreshCode;
399  mpData->result = UpdateVRuler | RefreshAll;
400 }
401 
403 // Table class
404 
406 {
410 
411 public:
412  static WaveformVRulerMenuTable &Instance();
413 
414 private:
415  virtual void InitMenu(Menu *pMenu, void *pUserData) override;
416 
417  void OnWaveformScaleType(wxCommandEvent &evt);
418 };
419 
421 {
422  static WaveformVRulerMenuTable instance;
423  return instance;
424 }
425 
426 void WaveformVRulerMenuTable::InitMenu(Menu *pMenu, void *pUserData)
427 {
428  WaveTrackVRulerMenuTable::InitMenu(pMenu, pUserData);
429 
430 // DB setting is already on track drop down.
431 #if 0
432  WaveTrack *const wt = mpData->pTrack;
433  const int id =
435  pMenu->Check(id, true);
436 #endif
437 }
438 
440 
441  POPUP_MENU_ITEM(OnZoomFitVerticalID, _("Zoom Reset\tShift-Right-Click"), OnZoomReset)
444 
445 #ifdef EXPERIMENTAL_HALF_WAVE
447 #endif
448 
450  POPUP_MENU_ITEM(OnZoomInVerticalID, _("Zoom In\tLeft-Click/Left-Drag"), OnZoomInVertical)
451  POPUP_MENU_ITEM(OnZoomOutVerticalID, _("Zoom Out\tShift-Left-Click"), OnZoomOutVertical)
452 // The log and linear options are already available as waveform db.
453 // So don't repeat them here.
454 #if 0
456  {
457  const wxArrayString & names = WaveformSettings::GetScaleNames();
458  for (int ii = 0, nn = names.size(); ii < nn; ++ii) {
460  OnWaveformScaleType);
461  }
462  }
463 #endif
465 
466 void WaveformVRulerMenuTable::OnWaveformScaleType(wxCommandEvent &evt)
467 {
468  WaveTrack *const wt = mpData->pTrack;
469  // Assume linked track is wave or null
470  const auto partner = static_cast<WaveTrack*>(wt->GetLink());
471  const WaveformSettings::ScaleType newScaleType =
473  std::max(0,
475  evt.GetId() - OnFirstWaveformScaleID
476  )));
477  if (wt->GetWaveformSettings().scaleType != newScaleType) {
478  wt->GetIndependentWaveformSettings().scaleType = newScaleType;
479  if (partner)
480  partner->GetIndependentWaveformSettings().scaleType = newScaleType;
481 
483 
484  using namespace RefreshCode;
485  mpData->result = UpdateVRuler | RefreshAll;
486  }
487 }
488 
490 // Table class
491 
493 {
497 
498 public:
499  static SpectrumVRulerMenuTable &Instance();
500 
501 private:
502  void InitMenu(Menu *pMenu, void *pUserData) override;
503 
504  void OnSpectrumScaleType(wxCommandEvent &evt);
505 };
506 
508 {
509  static SpectrumVRulerMenuTable instance;
510  return instance;
511 }
512 
513 void SpectrumVRulerMenuTable::InitMenu(Menu *pMenu, void *pUserData)
514 {
515  WaveTrackVRulerMenuTable::InitMenu(pMenu, pUserData);
516 
517  WaveTrack *const wt = mpData->pTrack;
518  const int id =
520  pMenu->Check(id, true);
521 }
522 
524 
525  {
526  const wxArrayString & names = SpectrogramSettings::GetScaleNames();
527  for (int ii = 0, nn = names.size(); ii < nn; ++ii) {
529  OnSpectrumScaleType);
530  }
531  }
532 
534  POPUP_MENU_ITEM(OnZoomResetID, _("Zoom Reset"), OnZoomReset)
535  POPUP_MENU_ITEM(OnZoomFitVerticalID, _("Zoom to Fit\tShift-Right-Click"), OnZoomFitVertical)
536  POPUP_MENU_ITEM(OnZoomInVerticalID, _("Zoom In\tLeft-Click/Left-Drag"), OnZoomInVertical)
537  POPUP_MENU_ITEM(OnZoomOutVerticalID, _("Zoom Out\tShift-Left-Click"), OnZoomOutVertical)
539 
540 void SpectrumVRulerMenuTable::OnSpectrumScaleType(wxCommandEvent &evt)
541 {
542  WaveTrack *const wt = mpData->pTrack;
543  // Assume linked track is wave or null
544  const auto partner = static_cast<WaveTrack*>(wt->GetLink());
545  const SpectrogramSettings::ScaleType newScaleType =
547  std::max(0,
549  evt.GetId() - OnFirstSpectrumScaleID
550  )));
551  if (wt->GetSpectrogramSettings().scaleType != newScaleType) {
552  wt->GetIndependentSpectrogramSettings().scaleType = newScaleType;
553  if (partner)
554  partner->GetIndependentSpectrogramSettings().scaleType = newScaleType;
555 
557 
558  using namespace RefreshCode;
559  mpData->result = UpdateVRuler | RefreshAll;
560  }
561 }
562 
564 
566 {
567  static auto zoomInCursor =
568  ::MakeCursor(wxCURSOR_MAGNIFIER, ZoomInCursorXpm, 19, 15);
569  static auto zoomOutCursor =
570  ::MakeCursor(wxCURSOR_MAGNIFIER, ZoomOutCursorXpm, 19, 15);
571  static wxCursor arrowCursor{ wxCURSOR_ARROW };
572  bool bVZoom;
573  gPrefs->Read(wxT("/GUI/VerticalZooming"), &bVZoom, false);
574  bVZoom &= !state.RightIsDown();
575  const auto message = bVZoom ?
576  _("Click to vertically zoom in. Shift-click to zoom out. Drag to specify a zoom region.") :
577  _("Right-click for menu.");
578 
579  return {
580  message,
581  bVZoom ? (state.ShiftDown() ? &*zoomOutCursor : &*zoomInCursor) : &arrowCursor
582  // , message
583  };
584 }
585 
587 {
588 }
589 
592 {
594 }
595 
597 (const TrackPanelMouseEvent &evt, AudacityProject *pProject)
598 {
599  using namespace RefreshCode;
600  auto pTrack = pProject->GetTracks()->Lock(mpTrack);
601  if (!pTrack)
602  return Cancelled;
603 
604  const wxMouseEvent &event = evt.event;
605  if ( event.RightIsDown() )
606  return RefreshNone;
607  mZoomEnd = event.m_y;
608  if (IsDragZooming(mZoomStart, mZoomEnd))
609  return RefreshAll;
610  return RefreshNone;
611 }
612 
615 {
616  return HitPreview(st.state);
617 }
618 
620 (const TrackPanelMouseEvent &evt, AudacityProject *pProject,
621  wxWindow *pParent)
622 {
623  using namespace RefreshCode;
624  auto pTrack = pProject->GetTracks()->Lock(mpTrack);
625  if (!pTrack)
626  return RefreshNone;
627 
628  const wxMouseEvent &event = evt.event;
629  const bool shiftDown = event.ShiftDown();
630  const bool rightUp = event.RightUp();
631 
632 
633  bool bVZoom;
634  gPrefs->Read(wxT("/GUI/VerticalZooming"), &bVZoom, false);
635 
636  // Popup menu...
637  if (
638  rightUp &&
639  !(event.ShiftDown() || event.CmdDown()))
640  {
641  InitMenuData data {
642  pTrack.get(), mRect, RefreshCode::RefreshNone, event.m_y
643  };
644 
645  PopupMenuTable *const pTable =
646  (pTrack->GetDisplay() == WaveTrack::Spectrum)
649  std::unique_ptr<PopupMenuTable::Menu>
650  pMenu(PopupMenuTable::BuildMenu(pParent, pTable, &data));
651 
652  // Accelerators only if zooming enabled.
653  if( !bVZoom )
654  {
655  wxMenuItemList & L = pMenu->GetMenuItems();
656  // let's iterate over the list in STL syntax
657  wxMenuItemList::iterator iter;
658  for (iter = L.begin(); iter != L.end(); ++iter)
659  {
660  wxMenuItem *pItem = *iter;
661  // Remove accelerator, if any.
662  pItem->SetItemLabel( (pItem->GetItemLabel() + "\t" ).BeforeFirst('\t') );
663  }
664  }
665 
666 
667  pParent->PopupMenu(pMenu.get(), event.m_x, event.m_y);
668 
669  return data.result;
670  }
671  else{
672  // Ignore Capture Lost event
673  bVZoom &= event.GetId() != kCaptureLostEventId;
674  // shiftDown | rightUp | ZoomKind
675  // T | T | 1to1
676  // T | F | Out
677  // F | - | In
678  if( bVZoom ){
679  if( shiftDown )
680  mZoomStart=mZoomEnd;
681  const auto partner = static_cast<WaveTrack *>(pTrack->GetLink());
682  DoZoom(pProject, pTrack.get(), partner,
683  shiftDown ? (rightUp ? kZoom1to1 : kZoomOut) : kZoomIn,
684  mRect, mZoomStart, mZoomEnd, !shiftDown);
685  }
686  }
687 
688  return UpdateVRuler | RefreshAll;
689 }
690 
692 {
693  // Cancel is implemented! And there is no initial state to restore,
694  // so just return a code.
696 }
697 
699 (DrawingPass pass, wxDC * dc, const wxRegion &, const wxRect &panelRect)
700 {
701  if (!mpTrack.lock()) // TrackList::Lock()?
702  return;
703 
704  if ( pass == UIHandle::Cells &&
705  IsDragZooming( mZoomStart, mZoomEnd ) )
707  ( dc, mRect, panelRect, mZoomStart, mZoomEnd );
708 }
709 
#define POPUP_MENU_SEPARATOR()
static wxArrayString names()
Definition: Tags.cpp:697
AudacityPrefs * gPrefs
Definition: Prefs.cpp:73
bool isLinear() const
void Enter(bool forward) override
const int kZoomHalfWave
static SpectrumVRulerMenuTable & Instance()
Spectrogram settings, either for one track or as defaults.
const int DragThreshold
Definition: TrackPanel.h:242
const WaveformSettings & GetWaveformSettings() const
Definition: WaveTrack.cpp:738
WaveformSettings & GetIndependentWaveformSettings()
Definition: WaveTrack.cpp:754
float PositionToValue(float pp) const
Definition: NumberScale.h:154
void GetSpectrumBounds(float *min, float *max) const
Definition: WaveTrack.cpp:337
#define POPUP_MENU_RADIO_ITEM(id, string, memFn)
static HitTestPreview HitPreview(const wxMouseState &state)
void OnZoomReset(wxCommandEvent &)
void SetDisplayBounds(float min, float max) const
Definition: WaveTrack.cpp:331
size_t GetFFTLength() const
static const wxArrayString & GetScaleNames()
HitTestPreview Preview(const TrackPanelMouseState &state, const AudacityProject *pProject) override
#define END_POPUP_MENU()
const SpectrogramSettings & GetSpectrogramSettings() const
Definition: WaveTrack.cpp:690
SpectrogramSettings & GetIndependentSpectrogramSettings()
Definition: WaveTrack.cpp:706
Result Click(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
void OnZoomDiv2Vertical(wxCommandEvent &)
Result mChangeHighlight
Definition: UIHandle.h:150
NumberScale GetScale(float minFreq, float maxFreq) const
void GetDisplayBounds(float *min, float *max) const
Definition: WaveTrack.cpp:325
AudacityProject provides the main window, with tools and tracks contained within it.
Definition: Project.h:176
const int kZoomOut
unsigned Result
Definition: UIHandle.h:37
void InitMenu(Menu *pMenu, void *pUserData) override
const int kZoomTimes2
A Track that contains audio waveform data.
Definition: WaveTrack.h:60
Result Release(const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override
static std::unique_ptr< Menu > BuildMenu(wxEvtHandler *pParent, PopupMenuTable *pTable, void *pUserData=NULL)
WaveTrackVZoomHandle(const WaveTrackVZoomHandle &)
int min(int a, int b)
#define DECLARE_POPUP_MENU(HandlerClass)
static const wxArrayString & GetScaleNames()
std::shared_ptr< Subclass > Lock(const std::weak_ptr< Subclass > &wTrack)
Definition: Track.h:733
void OnZoomFitVertical(wxCommandEvent &)
void OnZoomTimes2Vertical(wxCommandEvent &)
void ModifyState(bool bWantsAutoSave)
Definition: Project.cpp:4740
Result Cancel(AudacityProject *pProject) override
Result Drag(const TrackPanelMouseEvent &event, AudacityProject *pProject) override
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
const int kZoom1to1
const int kZoomInByDrag
#define LINEAR_TO_DB(x)
Definition: Audacity.h:217
static void DoZoom(AudacityProject *pProject, WaveTrack *pTrack, WaveTrack *partner, int ZoomKind, const wxRect &rect, int zoomStart, int zoomEnd, bool fixedMousePoint)
POPUP_MENU_ITEM(OnMoveUpID, _("Move Track &Up")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveUp")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveDownID
Track * GetLink() const
Definition: Track.cpp:269
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:308
void SetSpectrumBounds(float min, float max) const
Definition: WaveTrack.cpp:381
static WaveformVRulerMenuTable & Instance()
std::unique_ptr< wxCursor > MakeCursor(int WXUNUSED(CursorId), const char *const pXpm[36], int HotX, int HotY)
Definition: TrackPanel.cpp:274
const int kZoomReset
void InitMenu(Menu *pMenu, void *pUserData) override
const int kCaptureLostEventId
void DrawExtras(DrawingPass pass, wxDC *dc, const wxRegion &updateRegion, const wxRect &panelRect) override
double GetRate() const
Definition: WaveTrack.cpp:398
TrackList * GetTracks()
Definition: Project.h:192
WaveTrackDisplay GetDisplay() const
Definition: WaveTrack.h:593
const int kZoomDiv2
const int kZoomIn
void OnZoomHalfWave(wxCommandEvent &)
void OnZoomInVertical(wxCommandEvent &)
static void DrawZooming(wxDC *dc, const wxRect &cellRect, const wxRect &panelRect, int zoomStart, int zoomEnd)
DrawingPass
Definition: UIHandle.h:43
void OnZoomOutVertical(wxCommandEvent &)
virtual void InitMenu(Menu *pMenu, void *pUserData) override
BEGIN_POPUP_MENU(SpectrumVRulerMenuTable)
Waveform settings, either for one track or as defaults.