2#include "../CommonCommandFlags.h"
3#include "../MenuCreator.h"
9#include "../TrackPanel.h"
15#include "../prefs/GUIPrefs.h"
16#include "../prefs/TracksPrefs.h"
19#include <wx/scrolbar.h>
33 const double lowerBound =
34 std::max(viewInfo.selectedRegion.t0(),
35 viewport.ScrollingLowerBoundTime());
37 viewInfo.selectedRegion.t1() - lowerBound;
39 return viewInfo.GetZoom();
51 auto width = viewInfo.GetTracksUsableWidth();
52 return (width - 1) / denom;
59 const double maxZoomOutFactor = 4.0;
61 const double pixelsPerUnit = 5.0;
65 double zoomToFit = viewport.GetZoomOfToFit();
79 result = pixelsPerUnit * 1.0/60;
82 result = pixelsPerUnit * 1.0;
85 result = pixelsPerUnit * 5.0;
88 result = pixelsPerUnit * 10.0;
91 result = pixelsPerUnit * 20.0;
94 result = pixelsPerUnit * 50.0;
97 result = pixelsPerUnit * 100.0;
100 result = pixelsPerUnit * 500.0;
103 result = pixelsPerUnit * 1000.0;
109 result = 44100.0 * 4;
115 if( result < (zoomToFit/maxZoomOutFactor) )
116 result = zoomToFit / maxZoomOutFactor;
135 if (gAudioIO->IsStreamActive(
137 !gAudioIO->IsPaused()){
138 viewport.ZoomBy(2.0);
139 viewport.ScrollIntoView(gAudioIO->GetStreamTime());
142 viewport.ZoomAboutSelection(2.0);
144 trackPanel.Refresh(
false);
153 trackPanel.Refresh(
false);
160 viewport.ZoomAboutCenter(0.5);
169 viewport.SetHorizontalThumb(selectedRegion.t0());
185 double Z = viewInfo.GetZoom();
187 fabs(log(Zoom1 / Z)) > fabs(log( Z / Zoom2)) ? Zoom1:Zoom2;
189 viewport.Zoom(ChosenZoom);
190 trackPanel.Refresh(
false);
200 viewport.ZoomFitHorizontally();
207 viewport.ZoomFitVertically();
229 auto &selectedRegion = viewInfo.selectedRegion;
232 if (selectedRegion.isPoint())
235 viewport.SetHorizontalThumb(
236 selectedRegion.t0() - ((viewInfo.GetScreenEndTime() - viewInfo.hpos) / 2));
243 auto &selectedRegion = viewInfo.selectedRegion;
246 if (selectedRegion.isPoint())
249 viewport.SetHorizontalThumb(
250 selectedRegion.t1() - ((viewInfo.GetScreenEndTime() - viewInfo.hpos) / 2));
258 bool checked = !
gPrefs->
Read(
wxT(
"/GUI/ShowExtraMenus"), 0L);
261 commandManager.Check(
wxT(
"ShowExtraMenus"), checked);
274 trackPanel.Refresh(
false);
287 trackPanel.Refresh(
false);
299 static auto menu = std::shared_ptr{
320 Command(
wxT(
"CollapseAllTracks"),
XXO(
"&Collapse All Tracks"),
322 Command(
wxT(
"ExpandAllTracks"),
XXO(
"E&xpand Collapsed Tracks"),
329 Options{
wxT(
"Ctrl+["),
XO(
"Skip to Selection Start") } ),
342 Command(
wxT(
"ShowClipping"),
XXO(
"&Show Clipping in Waveform"),
AttachedItem sAttachment1
constexpr CommandFlag AlwaysEnabledFlag
const ReservedCommandFlag & ZoomInAvailableFlag()
const ReservedCommandFlag & ZoomOutAvailableFlag()
const ReservedCommandFlag & TimeSelectedFlag()
const ReservedCommandFlag & TracksExistFlag()
XXO("&Cut/Copy/Paste Toolbar")
BoolSetting & ShowRMSPref()
BoolSetting & ShowClippingPref()
audacity::BasicSettings * gPrefs
declares abstract base class Track, TrackList, and iterators over TrackList
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
bool Toggle()
Write the negation of the previous value, and return true if successful.
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
AudacityProject & project
static CommandManager & Get(AudacityProject &project)
int GetAudioIOToken() const
static ProjectAudioIO & Get(AudacityProject &project)
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
Generates classes whose instances register items at construction.
static TrackPanel & Get(AudacityProject &project)
static WaveChannelViewConstants::ZoomPresets Zoom1Choice()
static WaveChannelViewConstants::ZoomPresets Zoom2Choice()
NotifyingSelectedRegion selectedRegion
static ViewInfo & Get(AudacityProject &project)
static Viewport & Get(AudacityProject &project)
static double GetDefaultZoom()
static double GetMaxZoom()
virtual bool Flush() noexcept=0
virtual bool Write(const wxString &key, bool value)=0
virtual bool Read(const wxString &key, bool *value) const =0
std::unique_ptr< detail::IndirectItem< Item > > Indirect(const std::shared_ptr< Item > &ptr)
A convenience function.