Audacity 3.2.0
Classes | Public Member Functions | Static Public Member Functions | Public Attributes | Private Member Functions | Private Attributes | List of all members
ProjectWindow Class Referencefinal

A top-level window associated with a project, and handling scrollbars and zooming. More...

#include <ProjectWindow.h>

Inheritance diagram for ProjectWindow:
[legend]
Collaboration diagram for ProjectWindow:
[legend]

Classes

class  PlaybackScroller
 
struct  PlaybackScrollerMessage
 

Public Member Functions

 ProjectWindow (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, AudacityProject &project)
 
 ~ProjectWindow () override
 
int NextWindowID ()
 
bool IsActive () override
 
bool IsIconized () const override
 
bool IsBeingDeleted () const
 
void SetIsBeingDeleted ()
 
void Reset ()
 
wxWindow * GetEffectsWindow () noexcept
 Effect window contains list off effects assigned to a selected track. More...
 
wxWindow * GetTrackListWindow () noexcept
 Track list window is the parent container for TrackPanel. More...
 
wxWindow * GetContainerWindow () noexcept
 Container is a parent window for both effects panel and track list windows. More...
 
wxPanel * GetTopPanel () noexcept
 Top panel contains project-related controls and tools. More...
 
void UpdateStatusWidths ()
 
PlaybackScrollerGetPlaybackScroller ()
 
void SetNormalizedWindowState (wxRect pSizeAndLocation)
 
wxRect GetNormalizedWindowState () const
 
void RedrawProject (const bool bForceWaveTracks=false)
 
void Zoom (double level)
 
void ZoomInByFactor (double ZoomFactor)
 
void ZoomOutByFactor (double ZoomFactor)
 
void ZoomBy (double multiplier)
 
void ZoomAfterImport (Track *pTrack)
 
double GetZoomOfToFit () const
 
void DoZoomFit ()
 
void ShowEffectsPanel (Track *track=nullptr)
 
void HideEffectsPanel ()
 
void ApplyUpdatedTheme ()
 
wxScrollBar & GetVerticalScrollBar ()
 
wxScrollBar & GetHorizontalScrollBar ()
 
void ScrollIntoView (double pos)
 
void ScrollIntoView (int x)
 
void OnScrollLeft ()
 
void OnScrollRight ()
 
void Rewind (bool shift)
 
void SkipEnd (bool shift)
 
void OnScrollLeftButton (wxScrollEvent &event)
 
void OnScrollRightButton (wxScrollEvent &event)
 
void FinishAutoScroll ()
 
void FixScrollbars ()
 
bool MayScrollBeyondZero () const
 
double ScrollingLowerBoundTime () const
 
double PixelWidthBeforeTime (double scrollto) const
 
void SetHorizontalThumb (double scrollto)
 
wxSize GetTPTracksUsableArea ()
 
void RefreshTPTrack (Track *pTrk, bool refreshbacking=true)
 
void TP_RedrawScrollbars () override
 
void TP_ScrollLeft () override
 
void TP_ScrollRight () override
 
void TP_ScrollWindow (double scrollto) override
 
bool TP_ScrollUpDown (int delta) override
 
void TP_HandleResize () override
 
void OnMenu (wxCommandEvent &event)
 
void OnUpdateUI (wxUpdateUIEvent &event)
 
void MacShowUndockedToolbars (bool show)
 
void OnActivate (wxActivateEvent &event)
 
void OnMouseEvent (wxMouseEvent &event)
 
void OnIconize (wxIconizeEvent &event)
 
void OnSize (wxSizeEvent &event)
 
void HandleResize ()
 
void UpdateLayout ()
 
void OnShow (wxShowEvent &event)
 
void OnMove (wxMoveEvent &event)
 
void DoScroll ()
 
void OnScroll (wxScrollEvent &event)
 
void OnToolBarUpdate (wxCommandEvent &event)
 
void OnUndoPushedModified ()
 
void OnUndoRedo ()
 
void OnUndoReset ()
 
- Public Member Functions inherited from ProjectWindowBase
 ProjectWindowBase (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, AudacityProject &project)
 
 ~ProjectWindowBase () override
 
AudacityProjectGetProject ()
 
const AudacityProjectGetProject () const
 
- Public Member Functions inherited from TrackPanelListener
 TrackPanelListener ()
 
virtual ~TrackPanelListener ()
 
virtual void TP_RedrawScrollbars ()=0
 
virtual void TP_ScrollLeft ()=0
 
virtual void TP_ScrollRight ()=0
 
virtual void TP_ScrollWindow (double scrollto)=0
 
virtual bool TP_ScrollUpDown (int delta)=0
 
virtual void TP_HandleResize ()=0
 
- Public Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 

Static Public Member Functions

static ProjectWindowGet (AudacityProject &project)
 
static const ProjectWindowGet (const AudacityProject &project)
 
static ProjectWindowFind (AudacityProject *pProject)
 
static const ProjectWindowFind (const AudacityProject *pProject)
 
static void OnResetWindow (const CommandContext &context)
 
- Static Public Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Public Attributes

bool mbInitializingScrollbar { false }
 

Private Member Functions

void OnThemeChange (wxCommandEvent &evt)
 
void UpdatePrefs () override
 

Private Attributes

wxRect mNormalizedWindowState
 
wxPanel * mTopPanel {}
 
wxSplitterWindow * mContainerWindow
 
wxWindow * mEffectsWindow {}
 
wxWindow * mTrackListWindow {}
 
wxScrollBar * mHsbar {}
 
wxScrollBar * mVsbar {}
 
int mNextWindowID {}
 
bool mAutoScrolling { false }
 
bool mActive { true }
 
bool mIconized { false }
 
bool mShownOnce { false }
 
bool mIsDeleting { false }
 
Observer::Subscription mUndoSubscription
 
std::unique_ptr< PlaybackScrollermPlaybackScroller
 

Additional Inherited Members

- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 
- Protected Attributes inherited from ProjectWindowBase
AudacityProjectmProject
 

Detailed Description

A top-level window associated with a project, and handling scrollbars and zooming.

Definition at line 32 of file ProjectWindow.h.

Constructor & Destructor Documentation

◆ ProjectWindow()

ProjectWindow::ProjectWindow ( wxWindow *  parent,
wxWindowID  id,
const wxPoint &  pos,
const wxSize &  size,
AudacityProject project 
)
explicit

Definition at line 589 of file ProjectWindow.cpp.

592 : ProjectWindowBase{ parent, id, pos, size, project }
593{
595
596 // Two sub-windows need to be made before Init(),
597 // so that this constructor can complete, and then TrackPanel and
598 // AdornedRulerPanel can retrieve those windows from this in their
599 // factory functions
600
601 // PRL: this panel groups the top tool dock and the ruler into one
602 // tab cycle.
603 // Must create it with non-default width equal to the main window width,
604 // or else the device toolbar doesn't make initial widths of the choice
605 // controls correct.
607 this, wxID_ANY, wxDefaultPosition,
608 wxSize{ this->GetSize().GetWidth(), -1 }
609 };
610 mTopPanel->SetLabel( "Top Panel" );// Not localised
611 mTopPanel->SetLayoutDirection(wxLayout_LeftToRight);
612 mTopPanel->SetAutoLayout(true);
613#ifdef EXPERIMENTAL_DA2
614 mTopPanel->SetBackgroundColour(theTheme.Colour( clrMedium ));
615#endif
616
617 auto container = safenew wxSplitterWindow(this, wxID_ANY,
618 wxDefaultPosition,
619 wxDefaultSize,
620 wxNO_BORDER | wxSP_LIVE_UPDATE);
621 container->Bind(wxEVT_SPLITTER_DOUBLECLICKED, [](wxSplitterEvent& event){
622 //"The default behaviour is to unsplit the window"
623 event.Veto();//do noting instead
624 });
625 mContainerWindow = container;
626
628 wxDefaultPosition,
629 wxDefaultSize,
630 wxNO_BORDER);
631 mTrackListWindow->SetSizer( safenew wxBoxSizer(wxVERTICAL) );
632 mTrackListWindow->SetLabel("Main Panel");// Not localized.
633 mTrackListWindow->SetLayoutDirection(wxLayout_LeftToRight);
634
635 mEffectsWindow = safenew wxWindow(mContainerWindow, wxID_ANY, wxDefaultPosition, wxSize(250, 20));
636 mEffectsWindow->Hide();//initially hidden
638
639#ifdef EXPERIMENTAL_DA2
640 mTrackListWindow->SetBackgroundColour(theTheme.Colour( clrMedium ));
641#endif
642
643 mPlaybackScroller = std::make_unique<PlaybackScroller>( &project );
644
645 // PRL: Old comments below. No longer observing the ordering that it
646 // recommends. ProjectWindow::OnActivate puts the focus directly into
647 // the TrackPanel, which avoids the problems.
648 // LLL: When Audacity starts or becomes active after returning from
649 // another application, the first window that can accept focus
650 // will be given the focus even if we try to SetFocus(). By
651 // creating the scrollbars after the TrackPanel, we resolve
652 // several focus problems.
653
654 mHsbar = safenew ScrollBar(mTrackListWindow, HSBarID, wxSB_HORIZONTAL);
655 mVsbar = safenew ScrollBar(mTrackListWindow, VSBarID, wxSB_VERTICAL);
656#if wxUSE_ACCESSIBILITY
657 // so that name can be set on a standard control
658 mHsbar->SetAccessible(safenew WindowAccessible(mHsbar));
659 mVsbar->SetAccessible(safenew WindowAccessible(mVsbar));
660#endif
661 mHsbar->SetLayoutDirection(wxLayout_LeftToRight);
662 mHsbar->SetName(_("Horizontal Scrollbar"));
663 mVsbar->SetName(_("Vertical Scrollbar"));
664
666 .Subscribe([this](UndoRedoMessage message){
667 switch (message.type) {
668 case UndoRedoMessage::Pushed:
669 case UndoRedoMessage::Modified:
670 return OnUndoPushedModified();
671 case UndoRedoMessage::UndoOrRedo:
672 return OnUndoRedo();
673 case UndoRedoMessage::Reset:
674 return OnUndoReset();
675 default:
676 return;
677 }
678 });
679
680 wxTheApp->Bind(EVT_THEME_CHANGE, &ProjectWindow::OnThemeChange, this);
681}
#define _(s)
Definition: Internat.h:75
#define safenew
Definition: MemoryX.h:10
@ VSBarID
@ HSBarID
@ NextID
THEME_API Theme theTheme
Definition: Theme.cpp:82
int id
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
Definition: Observer.h:199
A top-level window associated with a project.
wxScrollBar * mHsbar
wxSplitterWindow * mContainerWindow
wxPanel * mTopPanel
void OnThemeChange(wxCommandEvent &evt)
wxWindow * mEffectsWindow
std::unique_ptr< PlaybackScroller > mPlaybackScroller
Observer::Subscription mUndoSubscription
wxScrollBar * mVsbar
wxWindow * mTrackListWindow
wxColour & Colour(int iIndex)
static UndoManager & Get(AudacityProject &project)
Definition: UndoManager.cpp:67
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...
Type of message published by UndoManager.
Definition: UndoManager.h:61
enum UndoRedoMessage::Type type

References _, ThemeBase::Colour(), UndoManager::Get(), HSBarID, mContainerWindow, mEffectsWindow, mHsbar, mNextWindowID, mPlaybackScroller, mTopPanel, mTrackListWindow, mUndoSubscription, mVsbar, NextID, OnThemeChange(), safenew, Observer::Publisher< Message, NotifyAll >::Subscribe(), theTheme, UndoRedoMessage::type, and VSBarID.

Here is the call graph for this function:

◆ ~ProjectWindow()

ProjectWindow::~ProjectWindow ( )
override

Definition at line 683 of file ProjectWindow.cpp.

684{
685 // Tool manager gives us capture sometimes
686 if(HasCapture())
687 ReleaseMouse();
688}

Member Function Documentation

◆ ApplyUpdatedTheme()

void ProjectWindow::ApplyUpdatedTheme ( )

Definition at line 709 of file ProjectWindow.cpp.

710{
711 auto &project = mProject;
712 SetBackgroundColour(theTheme.Colour( clrMedium ));
713 ClearBackground();// For wxGTK.
714}
AudacityProject & mProject

References ThemeBase::Colour(), and theTheme.

Referenced by OnThemeChange().

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

◆ DoScroll()

void ProjectWindow::DoScroll ( )

Definition at line 1470 of file ProjectWindow.cpp.

1471{
1472 auto &project = mProject;
1473 auto &trackPanel = GetProjectPanel( project );
1474 auto &viewInfo = ViewInfo::Get( project );
1475 const double lowerBound = ScrollingLowerBoundTime();
1476
1477 auto width = viewInfo.GetTracksUsableWidth();
1478 viewInfo.SetBeforeScreenWidth(viewInfo.sbarH, width, lowerBound);
1479
1480
1481 if (MayScrollBeyondZero()) {
1482 enum { SCROLL_PIXEL_TOLERANCE = 10 };
1483 if (std::abs(viewInfo.TimeToPosition(0.0, 0
1484 )) < SCROLL_PIXEL_TOLERANCE) {
1485 // Snap the scrollbar to 0
1486 viewInfo.h = 0;
1487 SetHorizontalThumb(0.0);
1488 }
1489 }
1490
1491 viewInfo.vpos = mVsbar->GetThumbPosition() * viewInfo.scrollStep;
1492
1493 //mchinen: do not always set this project to be the active one.
1494 //a project may autoscroll while playing in the background
1495 //I think this is okay since OnMouseEvent has one of these.
1496 //SetActiveProject(this);
1497
1498 if (!mAutoScrolling) {
1499 trackPanel.Refresh(false);
1500 }
1501}
AUDACITY_DLL_API wxWindow & GetProjectPanel(AudacityProject &project)
Get the main sub-window of the project frame that displays track data.
void SetHorizontalThumb(double scrollto)
double ScrollingLowerBoundTime() const
bool MayScrollBeyondZero() const
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References ViewInfo::Get(), GetProjectPanel(), mAutoScrolling, MayScrollBeyondZero(), ProjectWindowBase::mProject, mVsbar, ScrollingLowerBoundTime(), and SetHorizontalThumb().

Referenced by FinishAutoScroll(), OnScroll(), OnScrollLeftButton(), OnScrollRightButton(), TP_ScrollUpDown(), and TP_ScrollWindow().

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

◆ DoZoomFit()

void ProjectWindow::DoZoomFit ( )

Definition at line 1868 of file ProjectWindow.cpp.

1869{
1870 auto &project = mProject;
1871 auto &viewInfo = ViewInfo::Get( project );
1872 auto &tracks = TrackList::Get( project );
1873 auto &window = *this;
1874
1875 const double start = viewInfo.bScrollBeyondZero
1876 ? std::min(tracks.GetStartTime(), 0.0)
1877 : 0;
1878
1879 window.Zoom( window.GetZoomOfToFit() );
1880 window.TP_ScrollWindow(start);
1881}
int min(int a, int b)
static TrackList & Get(AudacityProject &project)
Definition: Track.cpp:467

References ViewInfo::Get(), TrackList::Get(), min(), and ProjectWindowBase::mProject.

Referenced by ZoomAfterImport().

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

◆ Find() [1/2]

ProjectWindow * ProjectWindow::Find ( AudacityProject pProject)
static

Definition at line 553 of file ProjectWindow.cpp.

554{
555 return pProject
557 : nullptr;
558}
AUDACITY_DLL_API AttachedWindows & GetAttachedWindows(AudacityProject &project)
Subclass * Find(const RegisteredFactory &key)
Get a (bare) pointer to an attachment, or null, down-cast it to Subclass *; will not create on demand...
Definition: ClientData.h:333
A top-level window associated with a project, and handling scrollbars and zooming.
Definition: ProjectWindow.h:35
AttachedWindows::RegisteredFactory sProjectWindowKey

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Find(), GetAttachedWindows(), and anonymous_namespace{ProjectWindow.cpp}::sProjectWindowKey.

Referenced by Exporter::CheckMix(), ExportMP3::Export(), ExportMultipleDialog::ExportMultipleByLabel(), ExportMultipleDialog::ExportMultipleByTrack(), Find(), Exporter::GetFilename(), ScreenshotCommand::GetFrontWindow(), ProjectManager::OnStatusChange(), ProjectManager::SetStatusText(), and ScreenshotCommand::WindowFileName().

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

◆ Find() [2/2]

const ProjectWindow * ProjectWindow::Find ( const AudacityProject pProject)
static

Definition at line 560 of file ProjectWindow.cpp.

561{
562 return Find( const_cast< AudacityProject * >( pProject ) );
563}
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:89
static ProjectWindow * Find(AudacityProject *pProject)

References Find().

Here is the call graph for this function:

◆ FinishAutoScroll()

void ProjectWindow::FinishAutoScroll ( )

Definition at line 761 of file ProjectWindow.cpp.

762{
763 // Set a flag so we don't have to generate two update events
764 mAutoScrolling = true;
765
766 // Call our Scroll method which updates our ViewInfo variables
767 // to reflect the positions of the scrollbars
768 DoScroll();
769
770 mAutoScrolling = false;
771}

References DoScroll(), and mAutoScrolling.

Referenced by OnScrollLeft(), and OnScrollRight().

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

◆ FixScrollbars()

void ProjectWindow::FixScrollbars ( )

Definition at line 1015 of file ProjectWindow.cpp.

1016{
1017 auto &project = mProject;
1018 auto &tracks = TrackList::Get( project );
1019 auto &trackPanel = GetProjectPanel( project );
1020 auto &viewInfo = ViewInfo::Get( project );
1021
1022 bool refresh = false;
1023 bool rescroll = false;
1024
1025 int totalHeight = TrackView::GetTotalHeight( tracks ) + 32;
1026
1027 auto panelWidth = viewInfo.GetTracksUsableWidth();
1028 auto panelHeight = viewInfo.GetHeight();
1029
1030 // (From Debian...at least I think this is the change corresponding
1031 // to this comment)
1032 //
1033 // (2.) GTK critical warning "IA__gtk_range_set_range: assertion
1034 // 'min < max' failed" because of negative numbers as result of window
1035 // size checking. Added a sanity check that straightens up the numbers
1036 // in edge cases.
1037 if (panelWidth < 0) {
1038 panelWidth = 0;
1039 }
1040 if (panelHeight < 0) {
1041 panelHeight = 0;
1042 }
1043
1044 auto LastTime = std::numeric_limits<double>::lowest();
1045 for (const Track *track : tracks) {
1046 // Iterate over pending changed tracks if present.
1047 track = track->SubstitutePendingChangedTrack().get();
1048 LastTime = std::max( LastTime, track->GetEndTime() );
1049 }
1050 LastTime =
1051 std::max(LastTime, viewInfo.selectedRegion.t1());
1052
1053 const double screen =
1054 viewInfo.GetScreenEndTime() - viewInfo.h;
1055 const double halfScreen = screen / 2.0;
1056
1057 // If we can scroll beyond zero,
1058 // Add 1/2 of a screen of blank space to the end
1059 // and another 1/2 screen before the beginning
1060 // so that any point within the union of the selection and the track duration
1061 // may be scrolled to the midline.
1062 // May add even more to the end, so that you can always scroll the starting time to zero.
1063 const double lowerBound = ScrollingLowerBoundTime();
1064 const double additional = MayScrollBeyondZero()
1065 ? -lowerBound + std::max(halfScreen, screen - LastTime)
1066 : screen / 4.0;
1067
1068 viewInfo.total = LastTime + additional;
1069
1070 // Don't remove time from total that's still on the screen
1071 viewInfo.total = std::max(viewInfo.total, viewInfo.h + screen);
1072
1073 if (viewInfo.h < lowerBound) {
1074 viewInfo.h = lowerBound;
1075 rescroll = true;
1076 }
1077
1078 viewInfo.sbarTotal = (wxInt64) (viewInfo.GetTotalWidth());
1079 viewInfo.sbarScreen = (wxInt64)(panelWidth);
1080 viewInfo.sbarH = (wxInt64) (viewInfo.GetBeforeScreenWidth());
1081
1082 // PRL: Can someone else find a more elegant solution to bug 812, than
1083 // introducing this boolean member variable?
1084 // Setting mVSbar earlier, int HandlXMLTag, didn't succeed in restoring
1085 // the vertical scrollbar to its saved position. So defer that till now.
1086 // mbInitializingScrollbar should be true only at the start of the life
1087 // of an AudacityProject reopened from disk.
1089 viewInfo.vpos = mVsbar->GetThumbPosition() * viewInfo.scrollStep;
1090 }
1092
1093 if (viewInfo.vpos >= totalHeight)
1094 viewInfo.vpos = totalHeight - 1;
1095 if (viewInfo.vpos < 0)
1096 viewInfo.vpos = 0;
1097
1098 bool oldhstate;
1099 bool oldvstate;
1100 bool newhstate =
1101 (viewInfo.GetScreenEndTime() - viewInfo.h) < viewInfo.total;
1102 bool newvstate = panelHeight < totalHeight;
1103
1104#ifdef __WXGTK__
1105 oldhstate = mHsbar->IsShown();
1106 oldvstate = mVsbar->IsShown();
1107 mHsbar->Show(newhstate);
1108 mVsbar->Show(panelHeight < totalHeight);
1109#else
1110 oldhstate = mHsbar->IsEnabled();
1111 oldvstate = mVsbar->IsEnabled();
1112 mHsbar->Enable(newhstate);
1113 mVsbar->Enable(panelHeight < totalHeight);
1114#endif
1115
1116 if (panelHeight >= totalHeight && viewInfo.vpos != 0) {
1117 viewInfo.vpos = 0;
1118
1119 refresh = true;
1120 rescroll = false;
1121 }
1122 if (!newhstate && viewInfo.sbarH != 0) {
1123 viewInfo.sbarH = 0;
1124
1125 refresh = true;
1126 rescroll = false;
1127 }
1128
1129 // wxScrollbar only supports int values but we need a greater range, so
1130 // we scale the scrollbar coordinates on demand. We only do this if we
1131 // would exceed the int range, so we can always use the maximum resolution
1132 // available.
1133
1134 // Don't use the full 2^31 max int range but a bit less, so rounding
1135 // errors in calculations do not overflow max int
1136 wxInt64 maxScrollbarRange = (wxInt64)(2147483647 * 0.999);
1137 if (viewInfo.sbarTotal > maxScrollbarRange)
1138 viewInfo.sbarScale = ((double)maxScrollbarRange) / viewInfo.sbarTotal;
1139 else
1140 viewInfo.sbarScale = 1.0; // use maximum resolution
1141
1142 {
1143 int scaledSbarH = (int)(viewInfo.sbarH * viewInfo.sbarScale);
1144 int scaledSbarScreen = (int)(viewInfo.sbarScreen * viewInfo.sbarScale);
1145 int scaledSbarTotal = (int)(viewInfo.sbarTotal * viewInfo.sbarScale);
1146 const int offset =
1147 (int)(floor(0.5 + viewInfo.sbarScale * PixelWidthBeforeTime(0.0)));
1148
1149 mHsbar->SetScrollbar(scaledSbarH + offset, scaledSbarScreen, scaledSbarTotal,
1150 scaledSbarScreen, TRUE);
1151 }
1152
1153 // Vertical scrollbar
1154 mVsbar->SetScrollbar(viewInfo.vpos / viewInfo.scrollStep,
1155 panelHeight / viewInfo.scrollStep,
1156 totalHeight / viewInfo.scrollStep,
1157 panelHeight / viewInfo.scrollStep, TRUE);
1158
1159 if (refresh || (rescroll &&
1160 (viewInfo.GetScreenEndTime() - viewInfo.h) < viewInfo.total)) {
1161 trackPanel.Refresh(false);
1162 }
1163
1164 MenuManager::Get( project ).UpdateMenus();
1165
1166 if (oldhstate != newhstate || oldvstate != newvstate) {
1167 UpdateLayout();
1168 }
1169}
static MenuManager & Get(AudacityProject &project)
Definition: Menus.cpp:71
void UpdateMenus(bool checkActive=true)
Definition: Menus.cpp:643
double PixelWidthBeforeTime(double scrollto) const
bool mbInitializingScrollbar
Abstract base class for an object holding data associated with points on a time axis.
Definition: Track.h:225
static int GetTotalHeight(const TrackList &list)
Definition: TrackView.cpp:47

References ViewInfo::Get(), TrackList::Get(), MenuManager::Get(), GetProjectPanel(), TrackView::GetTotalHeight(), MayScrollBeyondZero(), mbInitializingScrollbar, mHsbar, ProjectWindowBase::mProject, mVsbar, PixelWidthBeforeTime(), ScrollingLowerBoundTime(), UpdateLayout(), and MenuManager::UpdateMenus().

Referenced by HandleResize(), InitProjectWindow(), TP_RedrawScrollbars(), Zoom(), and ZoomBy().

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

◆ Get() [1/2]

ProjectWindow & ProjectWindow::Get ( AudacityProject project)
static

Definition at line 543 of file ProjectWindow.cpp.

544{
546}
Subclass & Get(const RegisteredFactory &key)
Get reference to an attachment, creating on demand if not present, down-cast it to Subclass.
Definition: ClientData.h:309

References ClientData::Site< Host, ClientData, ObjectCopyingPolicy, Pointer, ObjectLockingPolicy, RegistryLockingPolicy >::Get(), GetAttachedWindows(), and anonymous_namespace{ProjectWindow.cpp}::sProjectWindowKey.

Referenced by ProjectSelectionManager::AS_SetSnapTo(), EffectsButtonHandle::CommitChanges(), anonymous_namespace{TrackMenus.cpp}::DoAlign(), MacroCommands::DoAudacityCommand(), anonymous_namespace{SelectMenus.cpp}::DoBoundaryMove(), anonymous_namespace{ClipMenus.cpp}::DoClipLeftOrRight(), anonymous_namespace{ClipMenus.cpp}::DoCursorClipBoundary(), LOFImportFileHandle::doDurationAndScrollOffset(), LabelTrackView::DoEditLabels(), EffectUI::DoEffect(), anonymous_namespace{FileMenus.cpp}::DoImport(), DoImportMIDI(), LabelTrackView::DoKeyDown(), anonymous_namespace{TrackMenus.cpp}::DoMixAndRender(), anonymous_namespace{TransportMenus.cpp}::DoMoveToLabel(), anonymous_namespace{TrackMenus.cpp}::DoPanTracks(), anonymous_namespace{EditMenus.cpp}::DoPasteNothingSelected(), anonymous_namespace{EditMenus.cpp}::DoPasteText(), TrackUtilities::DoRemoveTrack(), anonymous_namespace{ClipMenus.cpp}::DoSelectClip(), Get(), GetNextWindowPlacement(), anonymous_namespace{ViewMenus.cpp}::GetZoomOfPreset(), anonymous_namespace{ViewMenus.cpp}::GetZoomOfSelection(), LabelTrackView::KeyDown(), MixerBoard::MixerBoard(), anonymous_namespace{SelectMenus.cpp}::MoveWhenAudioInactive(), TrackActions::Handler::MuteTracks(), ProjectManager::New(), anonymous_namespace{NavigationMenus.cpp}::NextOrPrevFrame(), PluginActions::Handler::OnApplyMacroDirectlyByName(), ApplyMacroDialog::OnApplyToFiles(), MixerTrackCluster::OnButton_Mute(), MixerTrackCluster::OnButton_Solo(), FileActions::Handler::OnClose(), ProjectManager::OnCloseWindow(), ViewActions::Handler::OnCollapseAllTracks(), SelectActions::Handler::OnCursorSelEnd(), SelectActions::Handler::OnCursorSelStart(), SelectActions::Handler::OnCursorTrackEnd(), SelectActions::Handler::OnCursorTrackStart(), EditActions::Handler::OnCut(), EditActions::Handler::OnDelete(), EditActions::Handler::OnDisjoin(), EditActions::Handler::OnDuplicate(), AudacityApp::OnExceptionInMainLoop(), ViewActions::Handler::OnExpandAllTracks(), ControlToolBar::OnFF(), ViewActions::Handler::OnGoSelEnd(), ViewActions::Handler::OnGoSelStart(), FileActions::Handler::OnImportLabels(), EditActions::Handler::OnJoin(), anonymous_namespace{WaveTrackMenuItems.cpp}::Handler::OnNewStereoTrack(), anonymous_namespace{TimeTrackMenuItems.cpp}::Handler::OnNewTimeTrack(), anonymous_namespace{WaveTrackMenuItems.cpp}::Handler::OnNewWaveTrack(), EditActions::Handler::OnPaste(), CommandHandler::OnReceiveCommand(), ProjectManager::OnReconnectionFailure(), EditActions::Handler::OnRedo(), TrackActions::Handler::OnResample(), OnResetWindow(), ControlToolBar::OnRewind(), LabelDialog::OnSelectCell(), SelectActions::Handler::OnSelectionRestore(), SelectActions::Handler::OnSelToEnd(), SelectActions::Handler::OnSelToStart(), ScreenshotBigDialog::OnShortTracks(), EditActions::Handler::OnSplitCut(), EditActions::Handler::OnSplitDelete(), EditActions::Handler::OnSplitNew(), ProjectWindow::PlaybackScroller::OnTimer(), PlayIndicatorOverlay::OnTimer(), SelectHandle::TimerHandler::OnTimer(), TrackPanel::OnTimer(), TransportActions::Handler::OnTimerRecord(), ToolsToolBar::OnToolChanged(), EditActions::Handler::OnTrim(), EditActions::Handler::OnUndo(), ViewActions::Handler::OnZoomFit(), ViewActions::Handler::OnZoomFitV(), ViewActions::Handler::OnZoomIn(), ViewActions::Handler::OnZoomNormal(), ViewActions::Handler::OnZoomOut(), ViewActions::Handler::OnZoomSel(), ViewActions::Handler::OnZoomToggle(), ProjectFileManager::OpenFile(), ProjectManager::OpenProject(), ProjectFileManager::OpenProjectFile(), PlayIndicatorOverlay::PlayIndicatorOverlay(), ProjectManager::ProjectManager(), ProjectManager::SaveWindowSize(), ScrubbingOverlay::ScrubbingOverlay(), ScrubForwarder::ScrubForwarder(), anonymous_namespace{SelectMenus.cpp}::SeekWhenAudioInactive(), ScreenshotBigDialog::SizeTracks(), ProjectSelectionManager::SnapSelection(), ControlToolBar::StartScrolling(), ControlToolBar::StartScrollingIfPreferred(), ControlToolBar::StopScrolling(), SelectHandle::TimerHandler::TimerHandler(), ScreenshotBigDialog::TimeZoom(), and TrackPanel::TrackPanel().

Here is the call graph for this function:

◆ Get() [2/2]

const ProjectWindow & ProjectWindow::Get ( const AudacityProject project)
static

Definition at line 548 of file ProjectWindow.cpp.

549{
550 return Get( const_cast< AudacityProject & >( project ) );
551}
static ProjectWindow & Get(AudacityProject &project)

References Get().

Here is the call graph for this function:

◆ GetContainerWindow()

wxWindow * ProjectWindow::GetContainerWindow ( )
noexcept

Container is a parent window for both effects panel and track list windows.

Returns
Pointer to a container window (not null)

Definition at line 1247 of file ProjectWindow.cpp.

1248{
1249 return mContainerWindow;
1250}

References mContainerWindow.

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetEffectsWindow()

wxWindow * ProjectWindow::GetEffectsWindow ( )
noexcept

Effect window contains list off effects assigned to a selected track.

Returns
Pointer to an effects side-panel window (not null)

Definition at line 1237 of file ProjectWindow.cpp.

1238{
1239 return mEffectsWindow;
1240}

References mEffectsWindow.

◆ GetHorizontalScrollBar()

wxScrollBar & ProjectWindow::GetHorizontalScrollBar ( )
inline

Definition at line 142 of file ProjectWindow.h.

142{ return *mHsbar; }

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetNormalizedWindowState()

wxRect ProjectWindow::GetNormalizedWindowState ( ) const
inline

Definition at line 122 of file ProjectWindow.h.

122{ return mNormalizedWindowState; }
wxRect mNormalizedWindowState

Referenced by ProjectManager::SaveWindowSize().

Here is the caller graph for this function:

◆ GetPlaybackScroller()

PlaybackScroller & ProjectWindow::GetPlaybackScroller ( )
inline

Definition at line 119 of file ProjectWindow.h.

119{ return *mPlaybackScroller; }

Referenced by MixerBoard::MixerBoard(), PlayIndicatorOverlay::PlayIndicatorOverlay(), ScrubbingOverlay::ScrubbingOverlay(), ControlToolBar::StartScrolling(), ControlToolBar::StartScrollingIfPreferred(), ControlToolBar::StopScrolling(), and SelectHandle::TimerHandler::TimerHandler().

Here is the caller graph for this function:

◆ GetTopPanel()

wxPanel * ProjectWindow::GetTopPanel ( )
noexcept

Top panel contains project-related controls and tools.

Returns
Pointer to a top panel window (not null)

Definition at line 1252 of file ProjectWindow.cpp.

1253{
1254 return mTopPanel;
1255}

References mTopPanel.

Referenced by InitProjectWindow(), and anonymous_namespace{NavigationMenus.cpp}::NextOrPrevFrame().

Here is the caller graph for this function:

◆ GetTPTracksUsableArea()

wxSize ProjectWindow::GetTPTracksUsableArea ( )

◆ GetTrackListWindow()

wxWindow * ProjectWindow::GetTrackListWindow ( )
noexcept

Track list window is the parent container for TrackPanel.

Returns
Pointer to a track list window (not null)

Definition at line 1242 of file ProjectWindow.cpp.

1243{
1244 return mTrackListWindow;
1245}

References mTrackListWindow.

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetVerticalScrollBar()

wxScrollBar & ProjectWindow::GetVerticalScrollBar ( )
inline

Definition at line 141 of file ProjectWindow.h.

141{ return *mVsbar; }

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetZoomOfToFit()

double ProjectWindow::GetZoomOfToFit ( ) const

Definition at line 1848 of file ProjectWindow.cpp.

1849{
1850 auto &project = mProject;
1851 auto &tracks = TrackList::Get( project );
1852 auto &viewInfo = ViewInfo::Get( project );
1853
1854 const double end = tracks.GetEndTime();
1855 const double start = viewInfo.bScrollBeyondZero
1856 ? std::min( tracks.GetStartTime(), 0.0)
1857 : 0;
1858 const double len = end - start;
1859
1860 if (len <= 0.0)
1861 return viewInfo.GetZoom();
1862
1863 auto w = viewInfo.GetTracksUsableWidth();
1864 w -= 10;
1865 return w/len;
1866}
auto end(const Ptr< Type, BaseDeleter > &p)
Enables range-for, if Traits<Type>::iterated_type is defined.
Definition: PackedArray.h:126

References PackedArray::end(), ViewInfo::Get(), TrackList::Get(), min(), and ProjectWindowBase::mProject.

Here is the call graph for this function:

◆ HandleResize()

void ProjectWindow::HandleResize ( )

Definition at line 1212 of file ProjectWindow.cpp.

1213{
1214 // Activate events can fire during window teardown, so just
1215 // ignore them.
1216 if (mIsDeleting) {
1217 return;
1218 }
1219
1220 CallAfter( [this]{
1221
1222 if (mIsDeleting)
1223 return;
1224
1225 FixScrollbars();
1226 UpdateLayout();
1227
1228 });
1229}
void CallAfter(Action action)
Schedule an action to be done later, and in the main thread.
Definition: BasicUI.cpp:38

References BasicUI::CallAfter(), FixScrollbars(), mIsDeleting, and UpdateLayout().

Referenced by OnSize(), OnToolBarUpdate(), OnUndoRedo(), OnUndoReset(), and TP_HandleResize().

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

◆ HideEffectsPanel()

void ProjectWindow::HideEffectsPanel ( )

Definition at line 1898 of file ProjectWindow.cpp.

1899{
1901 Layout();
1902}

References mContainerWindow, and mEffectsWindow.

◆ IsActive()

bool ProjectWindow::IsActive ( )
override

Definition at line 1570 of file ProjectWindow.cpp.

1571{
1572 return mActive;
1573}

References mActive.

◆ IsBeingDeleted()

bool ProjectWindow::IsBeingDeleted ( ) const
inline

Definition at line 56 of file ProjectWindow.h.

56{ return mIsDeleting; }

Referenced by OnActivate().

Here is the caller graph for this function:

◆ IsIconized()

bool ProjectWindow::IsIconized ( ) const
override

Definition at line 1232 of file ProjectWindow.cpp.

1233{
1234 return mIconized;
1235}

References mIconized.

Referenced by GetNextWindowPlacement(), OnMove(), and OnSize().

Here is the caller graph for this function:

◆ MacShowUndockedToolbars()

void ProjectWindow::MacShowUndockedToolbars ( bool  show)

Definition at line 1292 of file ProjectWindow.cpp.

1293{
1294 (void)show;//compiler food
1295#ifdef __WXMAC__
1296 // Save the focus so we can restore it to whatever had it before since
1297 // showing a previously hidden toolbar will cause the focus to be set to
1298 // its frame. If this is not done it will appear that activation events
1299 // aren't being sent to the project window since they are actually being
1300 // delivered to the last tool frame shown.
1301 wxWindow *focused = FindFocus();
1302
1303 // Find all the floating toolbars, and show or hide them
1304 const auto &children = GetChildren();
1305 for(const auto &child : children) {
1306 if (auto frame = dynamic_cast<ToolFrame*>(child)) {
1307 if (!show) {
1308 frame->Hide();
1309 }
1310 else if (frame->GetBar() &&
1311 frame->GetBar()->IsVisible() ) {
1312 frame->Show();
1313 }
1314 }
1315 }
1316
1317 // Restore the focus if needed
1318 if (focused) {
1319 focused->SetFocus();
1320 }
1321#endif
1322}
class ToolFrame
Definition: ToolManager.h:168

Referenced by OnIconize().

Here is the caller graph for this function:

◆ MayScrollBeyondZero()

bool ProjectWindow::MayScrollBeyondZero ( ) const

Definition at line 908 of file ProjectWindow.cpp.

909{
910 auto &project = mProject;
911 auto &scrubber = Scrubber::Get( project );
912 auto &viewInfo = ViewInfo::Get( project );
913 if (viewInfo.bScrollBeyondZero)
914 return true;
915
916 if (scrubber.HasMark() ||
917 ProjectAudioIO::Get( project ).IsAudioActive()) {
918 if (mPlaybackScroller) {
919 auto mode = mPlaybackScroller->GetMode();
920 if (mode == PlaybackScroller::Mode::Pinned ||
922 return true;
923 }
924 }
925
926 return false;
927}
bool IsAudioActive() const
static ProjectAudioIO & Get(AudacityProject &project)
static Scrubber & Get(AudacityProject &project)
Definition: Scrubbing.cpp:202

References ViewInfo::Get(), ProjectAudioIO::Get(), Scrubber::Get(), ProjectAudioIO::IsAudioActive(), mPlaybackScroller, ProjectWindowBase::mProject, ProjectWindow::PlaybackScroller::Pinned, and ProjectWindow::PlaybackScroller::Right.

Referenced by DoScroll(), FixScrollbars(), ProjectWindow::PlaybackScroller::OnTimer(), and ScrollingLowerBoundTime().

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

◆ NextWindowID()

int ProjectWindow::NextWindowID ( )

Definition at line 573 of file ProjectWindow.cpp.

574{
575 return mNextWindowID++;
576}

References mNextWindowID.

◆ OnActivate()

void ProjectWindow::OnActivate ( wxActivateEvent &  event)

Definition at line 1538 of file ProjectWindow.cpp.

1539{
1540 // Activate events can fire during window teardown, so just
1541 // ignore them.
1542 if (IsBeingDeleted()) {
1543 return;
1544 }
1545
1546 auto &project = mProject;
1547
1548 mActive = event.GetActive();
1549
1550 // Under Windows, focus can be "lost" when returning to
1551 // Audacity from a different application.
1552 //
1553 // This was observed by minimizing all windows using WINDOWS+M and
1554 // then ALT+TAB to return to Audacity. Focus will be given to the
1555 // project window frame which is not at all useful.
1556 //
1557 // So, we use ToolManager's observation of focus changes in a wxEventFilter.
1558 // Then, when we receive the
1559 // activate event, we restore that focus to the child or the track
1560 // panel if no child had the focus (which probably should never happen).
1561 if (mActive) {
1562 auto &toolManager = ToolManager::Get( project );
1563 SetActiveProject( &project );
1564 if ( ! toolManager.RestoreFocus() )
1565 GetProjectPanel( project ).SetFocus();
1566 }
1567 event.Skip();
1568}
void SetActiveProject(AudacityProject *project)
bool IsBeingDeleted() const
Definition: ProjectWindow.h:56
static ToolManager & Get(AudacityProject &project)

References ToolManager::Get(), GetProjectPanel(), IsBeingDeleted(), mActive, ProjectWindowBase::mProject, and SetActiveProject().

Here is the call graph for this function:

◆ OnIconize()

void ProjectWindow::OnIconize ( wxIconizeEvent &  event)

Definition at line 1324 of file ProjectWindow.cpp.

1325{
1326 //JKC: On Iconizing we get called twice. Don't know
1327 // why but it does no harm.
1328 // Should we be returning true/false rather than
1329 // void return? I don't know.
1330 mIconized = event.IsIconized();
1331
1332#if defined(__WXMAC__)
1333 // Readdresses bug 1431 since a crash could occur when restoring iconized
1334 // floating toolbars due to recursion (bug 2411).
1336 if( !mIconized )
1337 {
1338 Raise();
1339 }
1340#endif
1341
1342 // VisibileProjectCount seems to be just a counter for debugging.
1343 // It's not used outside this function.
1344 auto VisibleProjectCount = std::count_if(
1346 []( const AllProjects::value_type &ptr ){
1347 return !GetProjectFrame( *ptr ).IsIconized();
1348 }
1349 );
1350 event.Skip();
1351
1352 // This step is to fix part of Bug 2040, where the BackingPanel
1353 // size was not restored after we leave Iconized state.
1354
1355 // Queue up a resize event using OnShow so that we
1356 // refresh the track panel. But skip this, if we're iconized.
1357 if( mIconized )
1358 return;
1359 wxShowEvent Evt;
1360 OnShow( Evt );
1361}
AUDACITY_DLL_API wxFrame & GetProjectFrame(AudacityProject &project)
Get the top-level window associated with the project (as a wxFrame only, when you do not need to use ...
const_iterator end() const
Definition: Project.cpp:27
Container::value_type value_type
Definition: Project.h:56
const_iterator begin() const
Definition: Project.cpp:22
void OnShow(wxShowEvent &event)
void MacShowUndockedToolbars(bool show)

References AllProjects::begin(), AllProjects::end(), GetProjectFrame(), MacShowUndockedToolbars(), mIconized, and OnShow().

Here is the call graph for this function:

◆ OnMenu()

void ProjectWindow::OnMenu ( wxCommandEvent &  event)

Definition at line 1503 of file ProjectWindow.cpp.

1504{
1505#ifdef __WXMSW__
1506 // Bug 1642: We can arrive here with bogus menu IDs, which we
1507 // proceed to process. So if bogus, don't.
1508 // The bogus menu IDs are probably generated by controls on the TrackPanel,
1509 // such as the Project Rate.
1510 // 17000 is the magic number at which we start our menu.
1511 // This code would probably NOT be OK on Mac, since we assign
1512 // some specific ID numbers.
1513 if( event.GetId() < 17000){
1514 event.Skip();
1515 return;
1516 }
1517#endif
1518 auto &project = mProject;
1519 auto &commandManager = CommandManager::Get( project );
1520 bool handled = commandManager.HandleMenuID( GetProject(),
1521 event.GetId(), MenuManager::Get( project ).GetUpdateFlags(),
1522 false);
1523
1524 if (handled)
1525 event.Skip(false);
1526 else{
1527 event.ResumePropagation( 999 );
1528 event.Skip(true);
1529 }
1530}
static CommandManager & Get(AudacityProject &project)
CommandFlag GetUpdateFlags(bool checkActive=false) const
Definition: Menus.cpp:553
AudacityProject & GetProject()

References CommandManager::Get(), MenuManager::Get(), ProjectWindowBase::GetProject(), MenuManager::GetUpdateFlags(), and ProjectWindowBase::mProject.

Here is the call graph for this function:

◆ OnMouseEvent()

void ProjectWindow::OnMouseEvent ( wxMouseEvent &  event)

Definition at line 1575 of file ProjectWindow.cpp.

1576{
1577 auto &project = mProject;
1578 if (event.ButtonDown())
1579 SetActiveProject( &project );
1580}

References ProjectWindowBase::mProject, and SetActiveProject().

Here is the call graph for this function:

◆ OnMove()

void ProjectWindow::OnMove ( wxMoveEvent &  event)

Definition at line 1363 of file ProjectWindow.cpp.

1364{
1365 if (!this->IsMaximized() && !this->IsIconized())
1366 SetNormalizedWindowState(this->GetRect());
1367 event.Skip();
1368}
void SetNormalizedWindowState(wxRect pSizeAndLocation)
bool IsIconized() const override

References IsIconized(), and SetNormalizedWindowState().

Here is the call graph for this function:

◆ OnResetWindow()

void ProjectWindow::OnResetWindow ( const CommandContext context)
static

Definition at line 565 of file ProjectWindow.cpp.

566{
567 auto& project = context.project;
568 auto& window = ProjectWindow::Get(project);
569
570 window.Reset();
571}
AudacityProject & project

References Get(), and CommandContext::project.

Referenced by PluginActions::Handler::OnResetConfig().

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

◆ OnScroll()

void ProjectWindow::OnScroll ( wxScrollEvent &  event)

Definition at line 1452 of file ProjectWindow.cpp.

1453{
1454 auto &project = mProject;
1455 auto &viewInfo = ViewInfo::Get( project );
1456 const wxInt64 offset = PixelWidthBeforeTime(0.0);
1457 viewInfo.sbarH =
1458 (wxInt64)(mHsbar->GetThumbPosition() / viewInfo.sbarScale) - offset;
1459 DoScroll();
1460
1461#ifndef __WXMAC__
1462 // Bug2179
1463 // This keeps the time ruler in sync with horizontal scrolling, without
1464 // making an undesirable compilation dependency of this source file on
1465 // the ruler
1466 wxTheApp->ProcessIdle();
1467#endif
1468}

References DoScroll(), ViewInfo::Get(), mHsbar, ProjectWindowBase::mProject, and PixelWidthBeforeTime().

Here is the call graph for this function:

◆ OnScrollLeft()

void ProjectWindow::OnScrollLeft ( )

This method handles general left-scrolling, either for drag-scrolling or when the scrollbar is clicked to the left of the thumb

Definition at line 817 of file ProjectWindow.cpp.

818{
819 auto &project = mProject;
820 auto &viewInfo = ViewInfo::Get( project );
821 wxInt64 pos = mHsbar->GetThumbPosition();
822 // move at least one scroll increment
823 pos -= wxMax((wxInt64)(sbarHjump * viewInfo.sbarScale), 1);
824 pos = wxMax(pos, 0);
825 viewInfo.sbarH -= sbarHjump;
826 viewInfo.sbarH = std::max(viewInfo.sbarH,
827 -(wxInt64) PixelWidthBeforeTime(0.0));
828
829
830 if (pos != mHsbar->GetThumbPosition()) {
831 mHsbar->SetThumbPosition((int)pos);
833 }
834}
const int sbarHjump
void FinishAutoScroll()

References FinishAutoScroll(), ViewInfo::Get(), mHsbar, ProjectWindowBase::mProject, PixelWidthBeforeTime(), and sbarHjump.

Referenced by TP_ScrollLeft().

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

◆ OnScrollLeftButton()

void ProjectWindow::OnScrollLeftButton ( wxScrollEvent &  event)

This handles the event when the left direction button on the scrollbar is depressed

Definition at line 865 of file ProjectWindow.cpp.

866{
867 auto &project = mProject;
868 auto &viewInfo = ViewInfo::Get( project );
869 wxInt64 pos = mHsbar->GetThumbPosition();
870 // move at least one scroll increment
871 pos -= wxMax((wxInt64)(sbarHjump * viewInfo.sbarScale), 1);
872 pos = wxMax(pos, 0);
873 viewInfo.sbarH -= sbarHjump;
874 viewInfo.sbarH = std::max(viewInfo.sbarH,
875 - (wxInt64) PixelWidthBeforeTime(0.0));
876
877 if (pos != mHsbar->GetThumbPosition()) {
878 mHsbar->SetThumbPosition((int)pos);
879 DoScroll();
880 }
881}

References DoScroll(), ViewInfo::Get(), mHsbar, ProjectWindowBase::mProject, PixelWidthBeforeTime(), and sbarHjump.

Here is the call graph for this function:

◆ OnScrollRight()

void ProjectWindow::OnScrollRight ( )

This method handles general right-scrolling, either for drag-scrolling or when the scrollbar is clicked to the right of the thumb

Definition at line 840 of file ProjectWindow.cpp.

841{
842 auto &project = mProject;
843 auto &viewInfo = ViewInfo::Get( project );
844 wxInt64 pos = mHsbar->GetThumbPosition();
845 // move at least one scroll increment
846 // use wxInt64 for calculation to prevent temporary overflow
847 pos += wxMax((wxInt64)(sbarHjump * viewInfo.sbarScale), 1);
848 wxInt64 max = mHsbar->GetRange() - mHsbar->GetThumbSize();
849 pos = wxMin(pos, max);
850 viewInfo.sbarH += sbarHjump;
851 viewInfo.sbarH = std::min(viewInfo.sbarH,
852 viewInfo.sbarTotal
853 - (wxInt64) PixelWidthBeforeTime(0.0) - viewInfo.sbarScreen);
854
855 if (pos != mHsbar->GetThumbPosition()) {
856 mHsbar->SetThumbPosition((int)pos);
858 }
859}

References FinishAutoScroll(), ViewInfo::Get(), mHsbar, min(), ProjectWindowBase::mProject, PixelWidthBeforeTime(), and sbarHjump.

Referenced by TP_ScrollRight().

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

◆ OnScrollRightButton()

void ProjectWindow::OnScrollRightButton ( wxScrollEvent &  event)

This handles the event when the right direction button on the scrollbar is depressed

Definition at line 886 of file ProjectWindow.cpp.

887{
888 auto &project = mProject;
889 auto &viewInfo = ViewInfo::Get( project );
890 wxInt64 pos = mHsbar->GetThumbPosition();
891 // move at least one scroll increment
892 // use wxInt64 for calculation to prevent temporary overflow
893 pos += wxMax((wxInt64)(sbarHjump * viewInfo.sbarScale), 1);
894 wxInt64 max = mHsbar->GetRange() - mHsbar->GetThumbSize();
895 pos = wxMin(pos, max);
896 viewInfo.sbarH += sbarHjump;
897 viewInfo.sbarH = std::min(viewInfo.sbarH,
898 viewInfo.sbarTotal
899 - (wxInt64) PixelWidthBeforeTime(0.0) - viewInfo.sbarScreen);
900
901 if (pos != mHsbar->GetThumbPosition()) {
902 mHsbar->SetThumbPosition((int)pos);
903 DoScroll();
904 }
905}

References DoScroll(), ViewInfo::Get(), mHsbar, min(), ProjectWindowBase::mProject, PixelWidthBeforeTime(), and sbarHjump.

Here is the call graph for this function:

◆ OnShow()

void ProjectWindow::OnShow ( wxShowEvent &  event)

Definition at line 1388 of file ProjectWindow.cpp.

1389{
1390 // Remember that the window has been shown at least once
1391 mShownOnce = true;
1392
1393 // (From Debian...see also TrackPanel::OnTimer and AudacityTimer::Notify)
1394 //
1395 // Description: Workaround for wxWidgets bug: Reentry in clipboard
1396 // The wxWidgets bug http://trac.wxwidgets.org/ticket/16636 prevents
1397 // us from doing clipboard operations in wxShowEvent and wxTimerEvent
1398 // processing because those event could possibly be processed during
1399 // the (not sufficiently protected) Yield() of a first clipboard
1400 // operation, causing reentry. Audacity had a workaround in place
1401 // for this problem (the class "CaptureEvents"), which however isn't
1402 // applicable with wxWidgets 3.0 because it's based on changing the
1403 // gdk event handler, a change that would be overridden by wxWidgets's
1404 // own gdk event handler change.
1405 // Instead, as a NEW workaround, specifically protect those processings
1406 // of wxShowEvent and wxTimerEvent that try to do clipboard operations
1407 // from being executed within Yield(). This is done by delaying their
1408 // execution by posting pure wxWidgets events - which are never executed
1409 // during Yield().
1410 // Author: Martin Stegh fer <[email protected]>
1411 // Bug-Debian: https://bugs.debian.org/765341
1412
1413 // the actual creation/showing of the window).
1414 // Post the event instead of calling OnSize(..) directly. This ensures that
1415 // this is a pure wxWidgets event (no GDK event behind it) and that it
1416 // therefore isn't processed within the YieldFor(..) of the clipboard
1417 // operations (workaround for Debian bug #765341).
1418 // QueueEvent() will take ownership of the event
1419 GetEventHandler()->QueueEvent(safenew wxSizeEvent(GetSize()));
1420
1421 // Further processing by default handlers
1422 event.Skip();
1423}

References mShownOnce, and safenew.

Referenced by OnIconize().

Here is the caller graph for this function:

◆ OnSize()

void ProjectWindow::OnSize ( wxSizeEvent &  event)

Definition at line 1370 of file ProjectWindow.cpp.

1371{
1372 // (From Debian)
1373 //
1374 // (3.) GTK critical warning "IA__gdk_window_get_origin: assertion
1375 // 'GDK_IS_WINDOW (window)' failed": Received events of type wxSizeEvent
1376 // on the main project window cause calls to "ClientToScreen" - which is
1377 // not available until the window is first shown. So the class has to
1378 // keep track of wxShowEvent events and inhibit those actions until the
1379 // window is first shown.
1380 if (mShownOnce) {
1381 HandleResize();
1382 if (!this->IsMaximized() && !this->IsIconized())
1383 SetNormalizedWindowState(this->GetRect());
1384 }
1385 event.Skip();
1386}

References HandleResize(), IsIconized(), mShownOnce, and SetNormalizedWindowState().

Here is the call graph for this function:

◆ OnThemeChange()

void ProjectWindow::OnThemeChange ( wxCommandEvent &  evt)
private

Definition at line 741 of file ProjectWindow.cpp.

742{
743 evt.Skip();
744 auto &project = mProject;
745 this->ApplyUpdatedTheme();
746 auto &toolManager = ToolManager::Get( project );
747 for( int ii = 0; ii < ToolBarCount; ++ii )
748 {
749 ToolBar *pToolBar = toolManager.GetToolBar(ii);
750 if( pToolBar )
751 pToolBar->ReCreateButtons();
752 }
753}
@ ToolBarCount
Definition: ToolBar.h:87
void ApplyUpdatedTheme()
Works with ToolManager and ToolDock to provide a dockable window in which buttons can be placed.
Definition: ToolBar.h:98
virtual void ReCreateButtons()
Definition: ToolBar.cpp:516

References ApplyUpdatedTheme(), ToolManager::Get(), ProjectWindowBase::mProject, ToolBar::ReCreateButtons(), and ToolBarCount.

Referenced by ProjectWindow().

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

◆ OnToolBarUpdate()

void ProjectWindow::OnToolBarUpdate ( wxCommandEvent &  event)

A toolbar has been updated, so handle it like a sizing event.

Definition at line 1428 of file ProjectWindow.cpp.

1429{
1430 HandleResize();
1431
1432 event.Skip(false); /* No need to propagate any further */
1433}

References HandleResize().

Here is the call graph for this function:

◆ OnUndoPushedModified()

void ProjectWindow::OnUndoPushedModified ( )

Definition at line 1435 of file ProjectWindow.cpp.

1436{
1437 RedrawProject();
1438}
void RedrawProject(const bool bForceWaveTracks=false)

References RedrawProject().

Here is the call graph for this function:

◆ OnUndoRedo()

void ProjectWindow::OnUndoRedo ( )

Definition at line 1440 of file ProjectWindow.cpp.

1441{
1442 HandleResize();
1443 RedrawProject();
1444}

References HandleResize(), and RedrawProject().

Here is the call graph for this function:

◆ OnUndoReset()

void ProjectWindow::OnUndoReset ( )

Definition at line 1446 of file ProjectWindow.cpp.

1447{
1448 HandleResize();
1449 // RedrawProject(); // Should we do this here too?
1450}

References HandleResize().

Here is the call graph for this function:

◆ OnUpdateUI()

void ProjectWindow::OnUpdateUI ( wxUpdateUIEvent &  event)

Definition at line 1532 of file ProjectWindow.cpp.

1533{
1534 auto &project = mProject;
1535 MenuManager::Get( project ).UpdateMenus();
1536}

References MenuManager::Get(), ProjectWindowBase::mProject, and MenuManager::UpdateMenus().

Here is the call graph for this function:

◆ PixelWidthBeforeTime()

double ProjectWindow::PixelWidthBeforeTime ( double  scrollto) const

Definition at line 942 of file ProjectWindow.cpp.

943{
944 auto &project = mProject;
945 auto &viewInfo = ViewInfo::Get( project );
946 const double lowerBound = ScrollingLowerBoundTime();
947 return
948 // Ignoring fisheye is correct here
949 viewInfo.TimeRangeToPixelWidth(scrollto - lowerBound);
950}

References ViewInfo::Get(), ProjectWindowBase::mProject, and ScrollingLowerBoundTime().

Referenced by FixScrollbars(), OnScroll(), OnScrollLeft(), OnScrollLeftButton(), OnScrollRight(), OnScrollRightButton(), and SetHorizontalThumb().

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

◆ RedrawProject()

void ProjectWindow::RedrawProject ( const bool  bForceWaveTracks = false)

Definition at line 716 of file ProjectWindow.cpp.

717{
718 auto pThis = wxWeakRef<ProjectWindow>(this);
719 CallAfter( [pThis, bForceWaveTracks]{
720
721 if (!pThis)
722 return;
723 if (pThis->IsBeingDeleted())
724 return;
725
726 auto &project = pThis->mProject ;
727 auto &tracks = TrackList::Get( project );
728 auto &trackPanel = GetProjectPanel( project );
729 pThis->FixScrollbars();
730 if (bForceWaveTracks)
731 {
732 for ( auto pWaveTrack : tracks.Any< WaveTrack >() )
733 for (const auto &clip: pWaveTrack->GetClips())
734 clip->MarkChanged();
735 }
736 trackPanel.Refresh(false);
737
738 });
739}
for(int ii=0, nn=names.size();ii< nn;++ii)
A Track that contains audio waveform data.
Definition: WaveTrack.h:57

References BasicUI::CallAfter(), for(), TrackList::Get(), and GetProjectPanel().

Referenced by MixerTrackCluster::OnButton_Mute(), MixerTrackCluster::OnButton_Solo(), AudacityApp::OnExceptionInMainLoop(), CommandHandler::OnReceiveCommand(), LabelDialog::OnSelectCell(), ScreenshotBigDialog::OnShortTracks(), ToolsToolBar::OnToolChanged(), OnUndoPushedModified(), OnUndoRedo(), and ScreenshotBigDialog::SizeTracks().

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

◆ RefreshTPTrack()

void ProjectWindow::RefreshTPTrack ( Track pTrk,
bool  refreshbacking = true 
)

◆ Reset()

void ProjectWindow::Reset ( )

Definition at line 1257 of file ProjectWindow.cpp.

1258{
1259 wxRect defaultRect;
1260 GetDefaultWindowRect(&defaultRect);
1261
1262 SetSize(defaultRect.width, defaultRect.height);
1263}
void GetDefaultWindowRect(wxRect *defRect)

References GetDefaultWindowRect().

Here is the call graph for this function:

◆ Rewind()

void ProjectWindow::Rewind ( bool  shift)

Definition at line 1637 of file ProjectWindow.cpp.

1638{
1639 auto &project = mProject;
1640 auto &viewInfo = ViewInfo::Get( project );
1641 viewInfo.selectedRegion.setT0(0, false);
1642 if (!shift)
1643 viewInfo.selectedRegion.setT1(0);
1644
1645 TP_ScrollWindow(0);
1646}
void TP_ScrollWindow(double scrollto) override

References ViewInfo::Get(), ProjectWindowBase::mProject, and TP_ScrollWindow().

Referenced by ControlToolBar::OnRewind().

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

◆ ScrollingLowerBoundTime()

double ProjectWindow::ScrollingLowerBoundTime ( ) const

Definition at line 929 of file ProjectWindow.cpp.

930{
931 auto &project = mProject;
932 auto &tracks = TrackList::Get( project );
933 auto &viewInfo = ViewInfo::Get( project );
934 if (!MayScrollBeyondZero())
935 return 0;
936 const double screen = viewInfo.GetScreenEndTime() - viewInfo.h;
937 return std::min(tracks.GetStartTime(), -screen);
938}

References ViewInfo::Get(), TrackList::Get(), MayScrollBeyondZero(), min(), and ProjectWindowBase::mProject.

Referenced by DoScroll(), FixScrollbars(), and PixelWidthBeforeTime().

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

◆ ScrollIntoView() [1/2]

void ProjectWindow::ScrollIntoView ( double  pos)

Definition at line 792 of file ProjectWindow.cpp.

793{
794 auto &trackPanel = GetProjectPanel( mProject );
795 auto &viewInfo = ViewInfo::Get( mProject );
796 auto w = viewInfo.GetTracksUsableWidth();
797
798 int pixel = viewInfo.TimeToPosition(pos);
799 if (pixel < 0 || pixel >= w)
800 {
802 (viewInfo.OffsetTimeByPixels(pos, -(w / 2)));
803 trackPanel.Refresh(false);
804 }
805}

References ViewInfo::Get(), GetProjectPanel(), ProjectWindowBase::mProject, and TP_ScrollWindow().

Referenced by LabelTrackView::DoKeyDown(), LabelTrackView::KeyDown(), ScrollIntoView(), SkipEnd(), and ZoomInByFactor().

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

◆ ScrollIntoView() [2/2]

void ProjectWindow::ScrollIntoView ( int  x)

Definition at line 807 of file ProjectWindow.cpp.

808{
809 auto &viewInfo = ViewInfo::Get( mProject );
810 ScrollIntoView(viewInfo.PositionToTime(x, viewInfo.GetLeftOffset()));
811}
void ScrollIntoView(double pos)

References ViewInfo::Get(), ProjectWindowBase::mProject, and ScrollIntoView().

Here is the call graph for this function:

◆ SetHorizontalThumb()

void ProjectWindow::SetHorizontalThumb ( double  scrollto)

Definition at line 952 of file ProjectWindow.cpp.

953{
954 auto &project = mProject;
955 auto &viewInfo = ViewInfo::Get( project );
956 const auto unscaled = PixelWidthBeforeTime(scrollto);
957 const int max = mHsbar->GetRange() - mHsbar->GetThumbSize();
958 const int pos =
959 std::min(max,
960 std::max(0,
961 (int)(floor(0.5 + unscaled * viewInfo.sbarScale))));
962 mHsbar->SetThumbPosition(pos);
963 viewInfo.sbarH = floor(0.5 + unscaled - PixelWidthBeforeTime(0.0));
964 viewInfo.sbarH = std::max(viewInfo.sbarH,
965 - (wxInt64) PixelWidthBeforeTime(0.0));
966 viewInfo.sbarH = std::min(viewInfo.sbarH,
967 viewInfo.sbarTotal
968 - (wxInt64) PixelWidthBeforeTime(0.0) - viewInfo.sbarScreen);
969}

References ViewInfo::Get(), mHsbar, min(), ProjectWindowBase::mProject, and PixelWidthBeforeTime().

Referenced by DoScroll(), and TP_ScrollWindow().

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

◆ SetIsBeingDeleted()

void ProjectWindow::SetIsBeingDeleted ( )
inline

Definition at line 57 of file ProjectWindow.h.

57{ mIsDeleting = true; }

◆ SetNormalizedWindowState()

void ProjectWindow::SetNormalizedWindowState ( wxRect  pSizeAndLocation)
inline

Definition at line 121 of file ProjectWindow.h.

121{ mNormalizedWindowState = pSizeAndLocation; }

Referenced by OnMove(), and OnSize().

Here is the caller graph for this function:

◆ ShowEffectsPanel()

void ProjectWindow::ShowEffectsPanel ( Track track = nullptr)

Definition at line 1883 of file ProjectWindow.cpp.

1884{
1885 if(track == nullptr)
1886 return;
1887
1888 if(mContainerWindow->GetWindow1() != mEffectsWindow)
1889 {
1890 //Restore previous effects window size
1891 mContainerWindow->SplitVertically(
1894 mEffectsWindow->GetSize().GetWidth());
1895 }
1896}

References mContainerWindow, mEffectsWindow, and mTrackListWindow.

Referenced by EffectsButtonHandle::CommitChanges().

Here is the caller graph for this function:

◆ SkipEnd()

void ProjectWindow::SkipEnd ( bool  shift)

Definition at line 1657 of file ProjectWindow.cpp.

1658{
1659 auto &project = mProject;
1660 auto &tracks = TrackList::Get( project );
1661 auto &viewInfo = ViewInfo::Get( project );
1662 double len = tracks.GetEndTime();
1663
1664 viewInfo.selectedRegion.setT1(len, false);
1665 if (!shift)
1666 viewInfo.selectedRegion.setT0(len);
1667
1668 // Make sure the end of the track is visible
1669 ScrollIntoView(len);
1670}

References ViewInfo::Get(), TrackList::Get(), ProjectWindowBase::mProject, and ScrollIntoView().

Referenced by ControlToolBar::OnFF().

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

◆ TP_HandleResize()

void ProjectWindow::TP_HandleResize ( )
overridevirtual

Implements TrackPanelListener.

Definition at line 1690 of file ProjectWindow.cpp.

1691{
1692 HandleResize();
1693}

References HandleResize().

Here is the call graph for this function:

◆ TP_RedrawScrollbars()

void ProjectWindow::TP_RedrawScrollbars ( )
overridevirtual

Implements TrackPanelListener.

Definition at line 1685 of file ProjectWindow.cpp.

1686{
1687 FixScrollbars();
1688}

References FixScrollbars().

Here is the call graph for this function:

◆ TP_ScrollLeft()

void ProjectWindow::TP_ScrollLeft ( )
overridevirtual

Implements TrackPanelListener.

Definition at line 1673 of file ProjectWindow.cpp.

1674{
1675 OnScrollLeft();
1676}

References OnScrollLeft().

Here is the call graph for this function:

◆ TP_ScrollRight()

void ProjectWindow::TP_ScrollRight ( )
overridevirtual

Implements TrackPanelListener.

Definition at line 1679 of file ProjectWindow.cpp.

1680{
1681 OnScrollRight();
1682}

References OnScrollRight().

Here is the call graph for this function:

◆ TP_ScrollUpDown()

bool ProjectWindow::TP_ScrollUpDown ( int  delta)
overridevirtual

Implements TrackPanelListener.

Definition at line 989 of file ProjectWindow.cpp.

990{
991 int oldPos = mVsbar->GetThumbPosition();
992 int pos = oldPos + delta;
993 int max = mVsbar->GetRange() - mVsbar->GetThumbSize();
994
995 // Can be negative in case of only one track
996 if (max < 0)
997 max = 0;
998
999 if (pos > max)
1000 pos = max;
1001 else if (pos < 0)
1002 pos = 0;
1003
1004 if (pos != oldPos)
1005 {
1006 mVsbar->SetThumbPosition(pos);
1007
1008 DoScroll();
1009 return true;
1010 }
1011 else
1012 return false;
1013}

References DoScroll(), and mVsbar.

Here is the call graph for this function:

◆ TP_ScrollWindow()

void ProjectWindow::TP_ScrollWindow ( double  scrollto)
overridevirtual

Implements TrackPanelListener.

Definition at line 975 of file ProjectWindow.cpp.

976{
977 SetHorizontalThumb(scrollto);
978
979 // Call our Scroll method which updates our ViewInfo variables
980 // to reflect the positions of the scrollbars
981 DoScroll();
982}

References DoScroll(), and SetHorizontalThumb().

Referenced by LOFImportFileHandle::doDurationAndScrollOffset(), Rewind(), ScrollIntoView(), Zoom(), ZoomInByFactor(), and ZoomOutByFactor().

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

◆ UpdateLayout()

void ProjectWindow::UpdateLayout ( )

Definition at line 1171 of file ProjectWindow.cpp.

1172{
1173 auto &project = mProject;
1174 auto &trackPanel = GetProjectPanel( project );
1175 auto &toolManager = ToolManager::Get( project );
1176
1177 // 1. Layout panel, to get widths of the docks.
1178 Layout();
1179 // 2. Layout toolbars to pack the toolbars correctly in docks which
1180 // are now the correct width.
1181 toolManager.LayoutToolBars();
1182 // 3. Layout panel, to resize docks, in particular reducing the height
1183 // of any empty docks, or increasing the height of docks that need it.
1184 Layout();
1185
1186 // Bug 2455
1187 // The commented out code below is to calculate a nice minimum size for
1188 // the window. However on Ubuntu when the window is minimised it leads to
1189 // an insanely tall window.
1190 // Using a fixed min size fixes that.
1191 // However there is still something strange when minimised, as once
1192 // UpdateLayout is called once, when minimised, it gets called repeatedly.
1193#if 0
1194 // Retrieve size of this projects window
1195 wxSize mainsz = GetSize();
1196
1197 // Retrieve position of the track panel to use as the size of the top
1198 // third of the window
1199 wxPoint tppos = ClientToScreen(trackPanel.GetParent()->GetPosition());
1200
1201 // Retrieve position of bottom dock to use as the size of the bottom
1202 // third of the window
1203 wxPoint sbpos = ClientToScreen(toolManager.GetBotDock()->GetPosition());
1204
1205 // The "+ 50" is the minimum height of the TrackPanel
1206 SetMinSize( wxSize(250, (mainsz.y - sbpos.y) + tppos.y + 50));
1207#endif
1208 SetMinSize( wxSize(250, 250));
1209 SetMaxSize( wxSize(20000, 20000));
1210}

References ToolManager::Get(), GetProjectPanel(), and ProjectWindowBase::mProject.

Referenced by FixScrollbars(), and HandleResize().

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

◆ UpdatePrefs()

void ProjectWindow::UpdatePrefs ( )
overrideprivatevirtual

Implements PrefsListener.

Definition at line 755 of file ProjectWindow.cpp.

756{
757 // Update status bar widths in case of language change
759}
void UpdateStatusWidths()

References UpdateStatusWidths().

Here is the call graph for this function:

◆ UpdateStatusWidths()

void ProjectWindow::UpdateStatusWidths ( )

Definition at line 1265 of file ProjectWindow.cpp.

1266{
1267 enum { nWidths = nStatusBarFields + 1 };
1268 int widths[ nWidths ]{ 0 };
1269 widths[ rateStatusBarField ] = 150;
1270 const auto statusBar = GetStatusBar();
1271 const auto &functions = ProjectStatus::GetStatusWidthFunctions();
1272 // Start from 1 not 0
1273 // Specifying a first column always of width 0 was needed for reasons
1274 // I forget now
1275 for ( int ii = 1; ii <= nStatusBarFields; ++ii ) {
1276 int &width = widths[ ii ];
1277 for ( const auto &function : functions ) {
1278 auto results =
1279 function( mProject, static_cast< StatusBarField >( ii ) );
1280 for ( const auto &string : results.first ) {
1281 int w;
1282 statusBar->GetTextExtent(string.Translation(), &w, nullptr);
1283 width = std::max<int>( width, w + results.second );
1284 }
1285 }
1286 }
1287 // The main status field is not fixed width
1288 widths[ mainStatusBarField ] = -1;
1289 statusBar->SetStatusWidths( nWidths, widths );
1290}
StatusBarField
Definition: ProjectStatus.h:24
@ mainStatusBarField
Definition: ProjectStatus.h:26
@ nStatusBarFields
Definition: ProjectStatus.h:29
@ rateStatusBarField
Definition: ProjectStatus.h:27
static const StatusWidthFunctions & GetStatusWidthFunctions()

References ProjectStatus::GetStatusWidthFunctions(), mainStatusBarField, ProjectWindowBase::mProject, nStatusBarFields, and rateStatusBarField.

Referenced by InitProjectWindow(), and UpdatePrefs().

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

◆ Zoom()

void ProjectWindow::Zoom ( double  level)

Definition at line 1602 of file ProjectWindow.cpp.

1603{
1604 auto &project = mProject;
1605 auto &viewInfo = ViewInfo::Get( project );
1606 viewInfo.SetZoom(level);
1607 FixScrollbars();
1608 // See if we can center the selection on screen, and have it actually fit.
1609 // tOnLeft is the amount of time we would need before the selection left edge to center it.
1610 float t0 = viewInfo.selectedRegion.t0();
1611 float t1 = viewInfo.selectedRegion.t1();
1612 float tAvailable = viewInfo.GetScreenEndTime() - viewInfo.h;
1613 float tOnLeft = (tAvailable - t0 + t1)/2.0;
1614 // Bug 1292 (Enh) is effectively a request to do this scrolling of the selection into view.
1615 // If tOnLeft is positive, then we have room for the selection, so scroll to it.
1616 if( tOnLeft >=0 )
1617 TP_ScrollWindow( t0-tOnLeft);
1618}

References FixScrollbars(), ViewInfo::Get(), ProjectWindowBase::mProject, and TP_ScrollWindow().

Here is the call graph for this function:

◆ ZoomAfterImport()

void ProjectWindow::ZoomAfterImport ( Track pTrack)

Definition at line 1582 of file ProjectWindow.cpp.

1583{
1584 auto &project = mProject;
1585 auto &tracks = TrackList::Get( project );
1586 auto &trackPanel = GetProjectPanel( project );
1587
1588 DoZoomFit();
1589
1590 trackPanel.SetFocus();
1591 if (!pTrack)
1592 pTrack = *tracks.Selected().begin();
1593 if (!pTrack)
1594 pTrack = *tracks.Any().begin();
1595 if (pTrack) {
1596 TrackFocus::Get(project).Set(pTrack);
1597 pTrack->EnsureVisible();
1598 }
1599}
Track * Get()
void EnsureVisible(bool modifyState=false)
Definition: Track.cpp:98
bool Any() const
Definition: Track.cpp:380

References Track::Any(), DoZoomFit(), Track::EnsureVisible(), TrackFocus::Get(), TrackList::Get(), GetProjectPanel(), and ProjectWindowBase::mProject.

Referenced by DoImportMIDI(), ApplyMacroDialog::OnApplyToFiles(), and ProjectFileManager::OpenFile().

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

◆ ZoomBy()

void ProjectWindow::ZoomBy ( double  multiplier)

Definition at line 1621 of file ProjectWindow.cpp.

1622{
1623 auto &project = mProject;
1624 auto &viewInfo = ViewInfo::Get( project );
1625 viewInfo.ZoomBy(multiplier);
1626 FixScrollbars();
1627}

References FixScrollbars(), ViewInfo::Get(), and ProjectWindowBase::mProject.

Referenced by LOFImportFileHandle::doDurationAndScrollOffset(), ZoomInByFactor(), and ZoomOutByFactor().

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

◆ ZoomInByFactor()

void ProjectWindow::ZoomInByFactor ( double  ZoomFactor)

Definition at line 1751 of file ProjectWindow.cpp.

1752{
1753 auto &project = mProject;
1754 auto &viewInfo = ViewInfo::Get( project );
1755
1756 auto gAudioIO = AudioIO::Get();
1757 // LLL: Handling positioning differently when audio is
1758 // actively playing. Don't do this if paused.
1759 if (gAudioIO->IsStreamActive(
1760 ProjectAudioIO::Get( project ).GetAudioIOToken()) &&
1761 !gAudioIO->IsPaused()){
1762 ZoomBy(ZoomFactor);
1763 ScrollIntoView(gAudioIO->GetStreamTime());
1764 return;
1765 }
1766
1767 // DMM: Here's my attempt to get logical zooming behavior
1768 // when there's a selection that's currently at least
1769 // partially on-screen
1770
1771 const double endTime = viewInfo.GetScreenEndTime();
1772 const double duration = endTime - viewInfo.h;
1773
1774 bool selectionIsOnscreen =
1775 (viewInfo.selectedRegion.t0() < endTime) &&
1776 (viewInfo.selectedRegion.t1() >= viewInfo.h);
1777
1778 bool selectionFillsScreen =
1779 (viewInfo.selectedRegion.t0() < viewInfo.h) &&
1780 (viewInfo.selectedRegion.t1() > endTime);
1781
1782 if (selectionIsOnscreen && !selectionFillsScreen) {
1783 // Start with the center of the selection
1784 double selCenter = (viewInfo.selectedRegion.t0() +
1785 viewInfo.selectedRegion.t1()) / 2;
1786
1787 // If the selection center is off-screen, pick the
1788 // center of the part that is on-screen.
1789 if (selCenter < viewInfo.h)
1790 selCenter = viewInfo.h +
1791 (viewInfo.selectedRegion.t1() - viewInfo.h) / 2;
1792 if (selCenter > endTime)
1793 selCenter = endTime -
1794 (endTime - viewInfo.selectedRegion.t0()) / 2;
1795
1796 // Zoom in
1797 ZoomBy(ZoomFactor);
1798 const double newDuration =
1799 viewInfo.GetScreenEndTime() - viewInfo.h;
1800
1801 // Recenter on selCenter
1802 TP_ScrollWindow(selCenter - newDuration / 2);
1803 return;
1804 }
1805
1806
1807 double origLeft = viewInfo.h;
1808 double origWidth = duration;
1809 ZoomBy(ZoomFactor);
1810
1811 const double newDuration =
1812 viewInfo.GetScreenEndTime() - viewInfo.h;
1813 double newh = origLeft + (origWidth - newDuration) / 2;
1814
1815 // MM: Commented this out because it was confusing users
1816 /*
1817 // make sure that the *right-hand* end of the selection is
1818 // no further *left* than 1/3 of the way across the screen
1819 if (viewInfo.selectedRegion.t1() < newh + viewInfo.screen / 3)
1820 newh = viewInfo.selectedRegion.t1() - viewInfo.screen / 3;
1821
1822 // make sure that the *left-hand* end of the selection is
1823 // no further *right* than 2/3 of the way across the screen
1824 if (viewInfo.selectedRegion.t0() > newh + viewInfo.screen * 2 / 3)
1825 newh = viewInfo.selectedRegion.t0() - viewInfo.screen * 2 / 3;
1826 */
1827
1828 TP_ScrollWindow(newh);
1829}
static AudioIO * Get()
Definition: AudioIO.cpp:140
int GetAudioIOToken() const
void ZoomBy(double multiplier)

References AudioIO::Get(), ViewInfo::Get(), ProjectAudioIO::Get(), ProjectAudioIO::GetAudioIOToken(), ProjectWindowBase::mProject, ScrollIntoView(), TP_ScrollWindow(), and ZoomBy().

Here is the call graph for this function:

◆ ZoomOutByFactor()

void ProjectWindow::ZoomOutByFactor ( double  ZoomFactor)

Definition at line 1831 of file ProjectWindow.cpp.

1832{
1833 auto &project = mProject;
1834 auto &viewInfo = ViewInfo::Get( project );
1835
1836 //Zoom() may change these, so record original values:
1837 const double origLeft = viewInfo.h;
1838 const double origWidth = viewInfo.GetScreenEndTime() - origLeft;
1839
1840 ZoomBy(ZoomFactor);
1841 const double newWidth = viewInfo.GetScreenEndTime() - viewInfo.h;
1842
1843 const double newh = origLeft + (origWidth - newWidth) / 2;
1844 // newh = (newh > 0) ? newh : 0;
1845 TP_ScrollWindow(newh);
1846}

References ViewInfo::Get(), ProjectWindowBase::mProject, TP_ScrollWindow(), and ZoomBy().

Here is the call graph for this function:

Member Data Documentation

◆ mActive

bool ProjectWindow::mActive { true }
private

Definition at line 224 of file ProjectWindow.h.

Referenced by IsActive(), and OnActivate().

◆ mAutoScrolling

bool ProjectWindow::mAutoScrolling { false }
private

Definition at line 223 of file ProjectWindow.h.

Referenced by DoScroll(), and FinishAutoScroll().

◆ mbInitializingScrollbar

bool ProjectWindow::mbInitializingScrollbar { false }

Definition at line 208 of file ProjectWindow.h.

Referenced by FixScrollbars().

◆ mContainerWindow

wxSplitterWindow* ProjectWindow::mContainerWindow
private

◆ mEffectsWindow

wxWindow* ProjectWindow::mEffectsWindow {}
private

◆ mHsbar

wxScrollBar* ProjectWindow::mHsbar {}
private

◆ mIconized

bool ProjectWindow::mIconized { false }
private

Definition at line 225 of file ProjectWindow.h.

Referenced by IsIconized(), and OnIconize().

◆ mIsDeleting

bool ProjectWindow::mIsDeleting { false }
private

Definition at line 230 of file ProjectWindow.h.

Referenced by HandleResize().

◆ mNextWindowID

int ProjectWindow::mNextWindowID {}
private

Definition at line 221 of file ProjectWindow.h.

Referenced by NextWindowID(), and ProjectWindow().

◆ mNormalizedWindowState

wxRect ProjectWindow::mNormalizedWindowState
private

Definition at line 211 of file ProjectWindow.h.

◆ mPlaybackScroller

std::unique_ptr<PlaybackScroller> ProjectWindow::mPlaybackScroller
private

Definition at line 235 of file ProjectWindow.h.

Referenced by MayScrollBeyondZero(), and ProjectWindow().

◆ mShownOnce

bool ProjectWindow::mShownOnce { false }
private

Definition at line 226 of file ProjectWindow.h.

Referenced by OnShow(), and OnSize().

◆ mTopPanel

wxPanel* ProjectWindow::mTopPanel {}
private

Definition at line 213 of file ProjectWindow.h.

Referenced by GetTopPanel(), and ProjectWindow().

◆ mTrackListWindow

wxWindow* ProjectWindow::mTrackListWindow {}
private

Definition at line 216 of file ProjectWindow.h.

Referenced by GetTrackListWindow(), ProjectWindow(), and ShowEffectsPanel().

◆ mUndoSubscription

Observer::Subscription ProjectWindow::mUndoSubscription
private

Definition at line 234 of file ProjectWindow.h.

Referenced by ProjectWindow().

◆ mVsbar

wxScrollBar* ProjectWindow::mVsbar {}
private

Definition at line 219 of file ProjectWindow.h.

Referenced by DoScroll(), FixScrollbars(), ProjectWindow(), and TP_ScrollUpDown().


The documentation for this class was generated from the following files: