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