1#include "../CommonCommandFlags.h"
6#include "../ProjectSettings.h"
7#include "../ProjectWindow.h"
9#include "../TrackInfo.h"
10#include "../TrackPanel.h"
13#include "../commands/CommandContext.h"
14#include "../commands/CommandManager.h"
15#include "../prefs/GUIPrefs.h"
16#include "../prefs/TracksPrefs.h"
17#include "../tracks/ui/TrackView.h"
21#include <wx/scrolbar.h>
31 const double lowerBound =
32 std::max(viewInfo.selectedRegion.t0(),
33 window.ScrollingLowerBoundTime());
35 viewInfo.selectedRegion.t1() - lowerBound;
37 return viewInfo.GetZoom();
49 auto width = viewInfo.GetTracksUsableWidth();
50 return (width - 1) / denom;
57 const double maxZoomOutFactor = 4.0;
59 const double pixelsPerUnit = 5.0;
63 double zoomToFit = window.GetZoomOfToFit();
77 result = pixelsPerUnit * 1.0/60;
80 result = pixelsPerUnit * 1.0;
83 result = pixelsPerUnit * 5.0;
86 result = pixelsPerUnit * 10.0;
89 result = pixelsPerUnit * 20.0;
92 result = pixelsPerUnit * 50.0;
95 result = pixelsPerUnit * 100.0;
98 result = pixelsPerUnit * 500.0;
101 result = pixelsPerUnit * 1000.0;
107 result = 44100.0 * 4;
113 if( result < (zoomToFit/maxZoomOutFactor) )
114 result = zoomToFit / maxZoomOutFactor;
128 - [](
const Track *pTrack){
130 auto count = range.size();
135 auto height = viewInfo.GetHeight();
147 height = height / (int)count;
168 auto &project = context.
project;
171 window.ZoomInByFactor( 2.0 );
172 trackPanel.Refresh(
false);
177 auto &project = context.
project;
182 trackPanel.Refresh(
false);
187 auto &project = context.
project;
189 window.ZoomOutByFactor( 1 /2.0 );
194 auto &project = context.
project;
199 window.TP_ScrollWindow(selectedRegion.t0());
204 auto &project = context.
project;
215 double Z = viewInfo.GetZoom();
217 fabs(log(Zoom1 / Z)) > fabs(log( Z / Zoom2)) ? Zoom1:Zoom2;
219 window.Zoom(ChosenZoom);
220 trackPanel.Refresh(
false);
228 auto &project = context.
project;
235 auto &project = context.
project;
240 window.GetVerticalScrollBar().SetThumbPosition(0);
246 auto &project = context.
project;
249 bool checked = !
gPrefs->Read(
wxT(
"/GUI/VerticalZooming"), 0L);
250 gPrefs->Write(
wxT(
"/GUI/VerticalZooming"), checked);
252 commandManager.Check(
wxT(
"AdvancedVZoom"), checked);
258 auto &project = context.
project;
262 for (
auto t : tracks.Any())
270 auto &project = context.
project;
274 for (
auto t : tracks.Any())
282 auto &project = context.
project;
284 auto &selectedRegion = viewInfo.selectedRegion;
287 if (selectedRegion.isPoint())
290 window.TP_ScrollWindow(
291 selectedRegion.t0() - ((viewInfo.GetScreenEndTime() - viewInfo.h) / 2));
296 auto &project = context.
project;
298 auto &selectedRegion = viewInfo.selectedRegion;
301 if (selectedRegion.isPoint())
304 window.TP_ScrollWindow(
305 selectedRegion.t1() - ((viewInfo.GetScreenEndTime() - viewInfo.h) / 2));
310 auto &project = context.
project;
313 bool checked = !
gPrefs->Read(
wxT(
"/GUI/ShowExtraMenus"), 0L);
314 gPrefs->Write(
wxT(
"/GUI/ShowExtraMenus"), checked);
316 commandManager.Check(
wxT(
"ShowExtraMenus"), checked);
322 auto &project = context.
project;
326 bool checked = !
gPrefs->Read(
wxT(
"/GUI/ShowClipping"), 0L);
327 gPrefs->Write(
wxT(
"/GUI/ShowClipping"), checked);
329 commandManager.Check(
wxT(
"ShowClipping"), checked);
333 trackPanel.Refresh(
false);
338 auto &project = context.
project;
342 bool checked = !
gPrefs->Read(
wxT(
"/GUI/ShowTrackNameInWaveform"), 0L);
343 gPrefs->Write(
wxT(
"/GUI/ShowTrackNameInWaveform"), checked);
345 commandManager.Check(
wxT(
"ShowTrackNameInWaveform"), checked);
349 trackPanel.Refresh(
false);
357 if (
settings.GetTracksFitVerticallyZoomed())
383 return std::make_unique< ViewActions::Handler >( project ); } };
391#define FN(X) (& ViewActions::Handler :: X)
418 Command(
wxT(
"AdvancedVZoom"),
XXO(
"Advanced &Vertical Zooming"),
429 Command(
wxT(
"CollapseAllTracks"),
XXO(
"&Collapse All Tracks"),
431 Command(
wxT(
"ExpandAllTracks"),
XXO(
"E&xpand Collapsed Tracks"),
438 Options{
wxT(
"Ctrl+["),
XO(
"Skip to Selection Start") } ),
448 Command(
wxT(
"ShowExtraMenus"),
XXO(
"&Extra Menus (on/off)"),
451 Command(
wxT(
"ShowTrackNameInWaveform"),
XXO(
"Track &Name (on/off)"),
454 Command(
wxT(
"ShowClipping"),
XXO(
"&Show Clipping (on/off)"),
AttachedItem sAttachment1
constexpr CommandFlag AlwaysEnabledFlag
wxEvtHandler CommandHandlerObject
const ReservedCommandFlag & ZoomInAvailableFlag()
const ReservedCommandFlag & ZoomOutAvailableFlag()
const ReservedCommandFlag & TimeSelectedFlag()
const ReservedCommandFlag & TracksExistFlag()
XXO("&Cut/Copy/Paste Toolbar")
int ShowTrackNameInWaveformPrefsID()
int ShowClippingPrefsID()
EffectReverbSettings preset
declares abstract base class Track, TrackList, and iterators over TrackList
static Settings & settings()
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Track subclass holding data representing sound (as notes, or samples, or ...)
Client code makes static instance from a factory of attachments; passes it to Get or Find as a retrie...
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
AudacityProject & project
static CommandManager & Get(AudacityProject &project)
virtual bool Flush(bool bCurrentOnly=false) wxOVERRIDE
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
A move-only handle representing a connection to a Publisher.
static void Broadcast(int id=0)
Call this static function to notify all PrefsListener objects.
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
static ProjectSettings & Get(AudacityProject &project)
static ProjectWindow & Get(AudacityProject &project)
Abstract base class for an object holding data associated with points on a time axis.
static TrackList & Get(AudacityProject &project)
static TrackPanel & Get(AudacityProject &project)
void SetMinimized(bool minimized)
bool GetMinimized() const
void SetExpandedHeight(int height)
static int GetTrackHeight(const Track *pTrack)
static TrackView & Get(Track &)
static WaveTrackViewConstants::ZoomPresets Zoom1Choice()
static WaveTrackViewConstants::ZoomPresets Zoom2Choice()
static UndoManager & Get(AudacityProject &project)
NotifyingSelectedRegion selectedRegion
static ViewInfo & Get(AudacityProject &project)
static double GetDefaultZoom()
static double GetMaxZoom()
std::shared_ptr< BaseItem > BaseItemSharedPtr
AUDACITY_DLL_API unsigned MinimumTrackHeight()
CommandManager::Options Options
A convenient default parameter for class template Site.
Options && CheckTest(const CheckFn &fn) &&
Type of message published by UndoManager.
enum UndoRedoMessage::Type type
void OnCollapseAllTracks(const CommandContext &context)
void OnExpandAllTracks(const CommandContext &context)
Handler & operator=(const Handler &) PROHIBITED
Handler(const Handler &) PROHIBITED
void OnGoSelStart(const CommandContext &context)
void OnUndoPushed(UndoRedoMessage message)
Handler(AudacityProject &project)
void OnGoSelEnd(const CommandContext &context)
AudacityProject & mProject
void OnZoomFit(const CommandContext &context)
void OnZoomFitV(const CommandContext &context)
void OnZoomIn(const CommandContext &context)
void OnShowClipping(const CommandContext &context)
void OnZoomOut(const CommandContext &context)
void OnZoomToggle(const CommandContext &context)
Observer::Subscription mUndoSubscription
void OnAdvancedVZoom(const CommandContext &context)
void OnShowExtraMenus(const CommandContext &context)
void OnShowNameOverlay(const CommandContext &context)
void OnZoomNormal(const CommandContext &context)
void OnZoomSel(const CommandContext &context)