Audacity 3.2.0
Classes | Public Member Functions | Static Public Member Functions | 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 ()
 
wxWindow * GetTrackListWindow () noexcept
 Track list window is the parent container for TrackPanel. More...
 
wxSplitterWindow * 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 ApplyUpdatedTheme ()
 
wxScrollBar & GetVerticalScrollBar ()
 
wxScrollBar & GetHorizontalScrollBar ()
 
void OnScrollLeftButton (wxScrollEvent &event)
 
void OnScrollRightButton (wxScrollEvent &event)
 
std::pair< int, int > ViewportSize () const
 
unsigned MinimumTrackHeight ()
 
bool IsTrackMinimized (const Track &track)
 
void SetMinimized (Track &track, bool minimized)
 
int GetTrackHeight (const Track &track)
 
void SetChannelHeights (Track &track, unsigned height)
 
int GetTotalHeight (const TrackList &trackList)
 
int GetHorizontalThumbPosition () const
 
int GetHorizontalThumbSize () const
 
int GetHorizontalRange () const
 
void SetHorizontalThumbPosition (int viewStart)
 
void SetHorizontalScrollbar (int position, int thumbSize, int range, int pageSize, bool refresh)
 
void ShowHorizontalScrollbar (bool shown)
 
int GetVerticalThumbPosition () const
 
int GetVerticalThumbSize () const
 
int GetVerticalRange () const
 
void SetVerticalThumbPosition (int viewStart)
 
void SetVerticalScrollbar (int position, int thumbSize, int range, int pageSize, bool refresh)
 
void ShowVerticalScrollbar (bool shown)
 
void SetToDefaultSize ()
 
wxSize GetTPTracksUsableArea ()
 
void RefreshTPTrack (Track *pTrk, bool refreshbacking=true)
 
wxStatusBar * CreateProjectStatusBar ()
 
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 UpdateLayout ()
 
void OnShow (wxShowEvent &event)
 
void OnMove (wxMoveEvent &event)
 
void OnScroll (wxScrollEvent &event)
 
void OnToolBarUpdate (wxCommandEvent &event)
 
void OnProjectTitleChange (ProjectFileIOMessage)
 
- Public Member Functions inherited from ProjectWindowBase
 ProjectWindowBase (wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, AudacityProject &project)
 
 ~ProjectWindowBase () override
 
std::shared_ptr< AudacityProjectFindProject ()
 
std::shared_ptr< const AudacityProjectFindProject () const
 
- Public Member Functions inherited from PrefsListener
 PrefsListener ()
 
virtual ~PrefsListener ()
 
virtual void UpdatePrefs ()=0
 
- Public Member Functions inherited from Observer::Publisher< ProjectWindowDestroyedMessage >
 Publisher (ExceptionPolicy *pPolicy=nullptr, Alloc a={})
 Constructor supporting type-erased custom allocation/deletion. More...
 
 Publisher (Publisher &&)=default
 
Publisheroperator= (Publisher &&)=default
 
Subscription Subscribe (Callback callback)
 Connect a callback to the Publisher; later-connected are called earlier. More...
 
Subscription Subscribe (Object &obj, Return(Object::*callback)(Args...))
 Overload of Subscribe takes an object and pointer-to-member-function. More...
 

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 Public Member Functions inherited from PrefsListener
static void Broadcast (int id=0)
 Call this static function to notify all PrefsListener objects. More...
 

Private Member Functions

void OnThemeChange (struct ThemeChangeMessage)
 
void UpdatePrefs () override
 
void OnViewportMessage (const ViewportMessage &message)
 

Private Attributes

wxRect mNormalizedWindowState
 
wxPanel * mTopPanel {}
 
wxSplitterWindow * mContainerWindow
 
wxWindow * mTrackListWindow {}
 
wxScrollBar * mHsbar {}
 
wxScrollBar * mVsbar {}
 
int mNextWindowID {}
 
bool mActive { true }
 
bool mIconized { false }
 
bool mShownOnce { false }
 
bool mIsDeleting { false }
 
Observer::Subscription mThemeChangeSubscription
 
Observer::Subscription mTitleChangeSubscription
 
Observer::Subscription mSnappingChangedSubscription
 
std::unique_ptr< PlaybackScrollermPlaybackScroller
 
const Observer::Subscription mViewportSubscription
 

Additional Inherited Members

- Public Types inherited from Observer::Publisher< ProjectWindowDestroyedMessage >
using message_type = ProjectWindowDestroyedMessage
 
using CallbackReturn = std::conditional_t< true, void, bool >
 
using Callback = std::function< CallbackReturn(const ProjectWindowDestroyedMessage &) >
 Type of functions that can be connected to the Publisher. More...
 
- Static Public Attributes inherited from Observer::Publisher< ProjectWindowDestroyedMessage >
static constexpr bool notifies_all
 
- Protected Member Functions inherited from PrefsListener
virtual void UpdateSelectedPrefs (int id)
 
- Protected Member Functions inherited from Observer::Publisher< ProjectWindowDestroyedMessage >
CallbackReturn Publish (const ProjectWindowDestroyedMessage &message)
 Send a message to connected callbacks. More...
 
- Protected Attributes inherited from ProjectWindowBase
std::weak_ptr< AudacityProjectmwProject
 

Detailed Description

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

Definition at line 33 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 524 of file ProjectWindow.cpp.

527 : ProjectWindowBase{ parent, id, pos, size, project }
531{
532 Viewport::Get(project).SetCallbacks(std::make_unique<Adapter>(*this));
533
535
536 constexpr auto EffectsPanelMaxWidth { 500 };
537 constexpr auto TrackPanelMinWidth { 250 };
538
539 // Two sub-windows need to be made before Init(),
540 // so that this constructor can complete, and then TrackPanel and
541 // AdornedRulerPanel can retrieve those windows from this in their
542 // factory functions
543
544 // PRL: this panel groups the top tool dock and the ruler into one
545 // tab cycle.
546 // Must create it with non-default width equal to the main window width,
547 // or else the device toolbar doesn't make initial widths of the choice
548 // controls correct.
550 this, wxID_ANY, wxDefaultPosition,
551 wxSize{ this->GetSize().GetWidth(), -1 }
552 };
553 mTopPanel->SetLabel( "Top Panel" );// Not localised
554 mTopPanel->SetLayoutDirection(wxLayout_LeftToRight);
555 mTopPanel->SetAutoLayout(true);
556
557 auto container = safenew wxSplitterWindow(this, wxID_ANY,
558 wxDefaultPosition,
559 wxDefaultSize,
560 wxNO_BORDER | wxSP_LIVE_UPDATE | wxSP_THIN_SASH);
561 container->Bind(wxEVT_SPLITTER_DOUBLECLICKED, [](wxSplitterEvent& event){
562 //"The default behaviour is to unsplit the window"
563 event.Veto();//do noting instead
564 });
565 container->Bind(wxEVT_SPLITTER_SASH_POS_CHANGING, [=](wxSplitterEvent& event){
566 if(event.GetSashPosition() > EffectsPanelMaxWidth)
567 //Prevents left panel from expanding further
568 event.SetSashPosition(-1);
569 });
570 mContainerWindow = container;
571
573 wxDefaultPosition,
574 wxDefaultSize,
575 wxNO_BORDER);
576 mTrackListWindow->SetMinSize({TrackPanelMinWidth, -1});
577 mTrackListWindow->SetSizer( safenew wxBoxSizer(wxVERTICAL) );
578 mTrackListWindow->SetLabel("Main Panel");// Not localized.
579 mTrackListWindow->SetLayoutDirection(wxLayout_LeftToRight);
580
582
583 mPlaybackScroller = std::make_unique<PlaybackScroller>( &project );
584
585 // PRL: Old comments below. No longer observing the ordering that it
586 // recommends. ProjectWindow::OnActivate puts the focus directly into
587 // the TrackPanel, which avoids the problems.
588 // LLL: When Audacity starts or becomes active after returning from
589 // another application, the first window that can accept focus
590 // will be given the focus even if we try to SetFocus(). By
591 // creating the scrollbars after the TrackPanel, we resolve
592 // several focus problems.
593
594 mHsbar = safenew ScrollBar(mTrackListWindow, HSBarID, wxSB_HORIZONTAL);
595 mVsbar = safenew ScrollBar(mTrackListWindow, VSBarID, wxSB_VERTICAL);
596#if wxUSE_ACCESSIBILITY
597 // so that name can be set on a standard control
598 mHsbar->SetAccessible(safenew WindowAccessible(mHsbar));
599 mVsbar->SetAccessible(safenew WindowAccessible(mVsbar));
600#endif
601 mHsbar->SetLayoutDirection(wxLayout_LeftToRight);
602 mHsbar->SetName(_("Horizontal Scrollbar"));
603 mVsbar->SetName(_("Vertical Scrollbar"));
604
607
608 // Subscribe to title changes published by ProjectFileIO
611
612 // And also establish my initial consistency with it
614}
#define _(s)
Definition: Internat.h:73
#define safenew
Definition: MemoryX.h:10
@ ProjectTitleChange
A normal occurrence.
@ VSBarID
@ HSBarID
@ NextID
const auto project
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
static ProjectFileIO & Get(AudacityProject &project)
A top-level window associated with a project.
wxScrollBar * mHsbar
wxSplitterWindow * mContainerWindow
wxPanel * mTopPanel
Observer::Subscription mThemeChangeSubscription
void OnViewportMessage(const ViewportMessage &message)
Observer::Subscription mTitleChangeSubscription
std::unique_ptr< PlaybackScroller > mPlaybackScroller
void OnProjectTitleChange(ProjectFileIOMessage)
void OnThemeChange(struct ThemeChangeMessage)
wxScrollBar * mVsbar
wxWindow * mTrackListWindow
const Observer::Subscription mViewportSubscription
void SetCallbacks(std::unique_ptr< ViewportCallbacks > pCallbacks)
Definition: Viewport.cpp:64
static Viewport & Get(AudacityProject &project)
Definition: Viewport.cpp:33
An alternative to using wxWindowAccessible, which in wxWidgets 3.1.1 contained GetParent() which was ...

References _, ProjectFileIO::Get(), Viewport::Get(), HSBarID, mContainerWindow, mHsbar, mNextWindowID, mPlaybackScroller, mThemeChangeSubscription, mTitleChangeSubscription, mTopPanel, mTrackListWindow, mVsbar, NextID, OnProjectTitleChange(), OnThemeChange(), project, ProjectTitleChange, safenew, Viewport::SetCallbacks(), Observer::Publisher< Message, NotifyAll >::Subscribe(), theTheme, and VSBarID.

Here is the call graph for this function:

◆ ~ProjectWindow()

ProjectWindow::~ProjectWindow ( )
override

Definition at line 616 of file ProjectWindow.cpp.

617{
618 // Tool manager gives us capture sometimes
619 if(HasCapture())
620 ReleaseMouse();
621}

Member Function Documentation

◆ ApplyUpdatedTheme()

void ProjectWindow::ApplyUpdatedTheme ( )

Definition at line 642 of file ProjectWindow.cpp.

643{
644 SetBackgroundColour(theTheme.Colour( clrMedium ));
645 ClearBackground();// For wxGTK.
646}
wxColour & Colour(int iIndex)

References ThemeBase::Colour(), and theTheme.

Referenced by OnThemeChange().

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

◆ CreateProjectStatusBar()

wxStatusBar * ProjectWindow::CreateProjectStatusBar ( )

Definition at line 875 of file ProjectWindow.cpp.

876{
877 auto statusBar = GetStatusBar();
878
879 if (statusBar != nullptr)
880 statusBar->Destroy();
881
882 auto pProject = FindProject();
883
884 // Note that the first field of the status bar is a dummy, and its width is
885 // set to zero latter in the code. This field is needed for wxWidgets 2.8.12
886 // because if you move to the menu bar, the first field of the menu bar is
887 // cleared, which is undesirable behaviour. In addition, the help strings of
888 // menu items are by default sent to the first field. Currently there are no
889 // such help strings, but it they were introduced, then there would need to
890 // be an event handler to send them to the appropriate field.
891 statusBar = CreateStatusBar(
892 1 + ProjectStatusFieldsRegistry::Count(pProject.get()));
893
894 statusBar->Bind(
895 wxEVT_SIZE,
896 [this](auto& evt)
897 {
898 evt.Skip();
899 auto pProject = FindProject();
900 if (pProject != nullptr)
902 });
903
904 // We have a new status bar now, we need a full content update
905 if (pProject)
906 {
907 int index = 1;
909 [&](const StatusBarFieldItem& field, const auto&)
910 {
911 if (field.IsVisible(*pProject))
912 statusBar->SetStatusText(
913 field.GetText(*pProject).Translation(), index++);
914 });
915 }
916
917 return statusBar;
918}
#define field(n, t)
Definition: ImportAUP.cpp:165
std::shared_ptr< AudacityProject > FindProject()
Abstract base class for status bar fields.
Definition: ProjectStatus.h:38
static std::size_t Count(const AudacityProject *project)
Returns the number of fields in the registry. If project is no null, only visible fields are counted.
static void Visit(const StatusBarFieldRegistryVisitor &visitor)
Visits all fields in the registry in order.
static void OnSize(AudacityProject &project)
Handle OnSize event for all fields in the registry.

References ProjectStatusFieldsRegistry::Count(), field, ProjectWindowBase::FindProject(), ProjectStatusFieldsRegistry::OnSize(), and ProjectStatusFieldsRegistry::Visit().

Referenced by InitProjectWindow(), and UpdateStatusWidths().

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 418 of file ProjectWindow.cpp.

419{
420 return pProject
422 : nullptr;
423}
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:342
A top-level window associated with a project, and handling scrollbars and zooming.
Definition: ProjectWindow.h:36
AttachedWindows::RegisteredFactory sProjectWindowKey

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

Referenced by Find(), anonymous_namespace{AudioComMenus.cpp}::OnOpenFromCloud(), anonymous_namespace{AudioComMenus.cpp}::OnShareAudio(), ProjectManager::OnStatusChange(), and ProjectManager::SetStatusText().

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 425 of file ProjectWindow.cpp.

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

References Find().

Here is the call graph for this function:

◆ Get() [1/2]

ProjectWindow & ProjectWindow::Get ( AudacityProject project)
static

Definition at line 408 of file ProjectWindow.cpp.

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

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

Referenced by Get(), GetNextWindowPlacement(), audacity::cloud::audiocom::sync::anonymous_namespace{AudioComDialogBase.cpp}::GetProjectWindow(), audacity::cloud::audiocom::sync::CloudSyncStatusField::GetStatusWidget(), audacity::cloud::audiocom::sync::HandleMixdownLink(), RealtimeEffectPanel::HidePanel(), audacity::cloud::ShareAudioToolbar::MakeShareAudioButton(), MixerBoard::MixerBoard(), ProjectManager::New(), anonymous_namespace{NavigationMenus.cpp}::NextOrPrevFrame(), ProjectManager::OnCloseWindow(), ProjectManager::OnReconnectionFailure(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnSave(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudSyncStatusField.cpp}::CloudSyncStatusBarFieldItem::OnSize(), PlayIndicatorOverlay::OnTimer(), TrackPanel::OnTimer(), audacity::cloud::audiocom::sync::OpenProjectFromCloud(), PlayIndicatorOverlay::PlayIndicatorOverlay(), ProjectManager::ProjectManager(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::SaveCloudProject(), ProjectManager::SaveWindowSize(), ScrubbingOverlay::ScrubbingOverlay(), ScrubForwarder::ScrubForwarder(), RealtimeEffectStateUI::Show(), RealtimeEffectPanel::ShowPanel(), ControlToolBar::StartScrolling(), ControlToolBar::StartScrollingIfPreferred(), ControlToolBar::StopScrolling(), audacity::cloud::audiocom::sync::SyncCloudProject(), SelectHandle::TimerHandler::TimerHandler(), and TrackPanel::TrackPanel().

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

◆ Get() [2/2]

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

Definition at line 413 of file ProjectWindow.cpp.

414{
415 return Get( const_cast< AudacityProject & >( project ) );
416}
static ProjectWindow & Get(AudacityProject &project)

References Get(), and project.

Here is the call graph for this function:

◆ GetContainerWindow()

wxSplitterWindow * 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 857 of file ProjectWindow.cpp.

858{
859 return mContainerWindow;
860}

References mContainerWindow.

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetHorizontalRange()

int ProjectWindow::GetHorizontalRange ( ) const

Definition at line 743 of file ProjectWindow.cpp.

744{
745 return mHsbar->GetRange();
746}

References mHsbar.

◆ GetHorizontalScrollBar()

wxScrollBar & ProjectWindow::GetHorizontalScrollBar ( )
inline

Definition at line 122 of file ProjectWindow.h.

122{ return *mHsbar; }

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetHorizontalThumbPosition()

int ProjectWindow::GetHorizontalThumbPosition ( ) const

Definition at line 733 of file ProjectWindow.cpp.

734{
735 return mHsbar->GetThumbPosition();
736}

References mHsbar.

◆ GetHorizontalThumbSize()

int ProjectWindow::GetHorizontalThumbSize ( ) const

Definition at line 738 of file ProjectWindow.cpp.

739{
740 return mHsbar->GetThumbSize();
741}

References mHsbar.

◆ GetNormalizedWindowState()

wxRect ProjectWindow::GetNormalizedWindowState ( ) const
inline

Definition at line 114 of file ProjectWindow.h.

114{ return mNormalizedWindowState; }
wxRect mNormalizedWindowState

Referenced by ProjectManager::SaveWindowSize().

Here is the caller graph for this function:

◆ GetPlaybackScroller()

PlaybackScroller & ProjectWindow::GetPlaybackScroller ( )
inline

Definition at line 111 of file ProjectWindow.h.

111{ 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 862 of file ProjectWindow.cpp.

863{
864 return mTopPanel;
865}

References mTopPanel.

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetTotalHeight()

int ProjectWindow::GetTotalHeight ( const TrackList trackList)

Definition at line 722 of file ProjectWindow.cpp.

723{
724 return ChannelView::GetTotalHeight(trackList);
725}
static int GetTotalHeight(const TrackList &list)
Definition: ChannelView.cpp:62

References ChannelView::GetTotalHeight().

Here is the call graph for this function:

◆ GetTPTracksUsableArea()

wxSize ProjectWindow::GetTPTracksUsableArea ( )

◆ GetTrackHeight()

int ProjectWindow::GetTrackHeight ( const Track track)

Definition at line 717 of file ProjectWindow.cpp.

718{
720}
static int GetChannelGroupHeight(const Track *pTrack)
Definition: ChannelView.cpp:39

References ChannelView::GetChannelGroupHeight().

Here is the call graph for this function:

◆ 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 852 of file ProjectWindow.cpp.

853{
854 return mTrackListWindow;
855}

References mTrackListWindow.

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetVerticalRange()

int ProjectWindow::GetVerticalRange ( ) const

Definition at line 778 of file ProjectWindow.cpp.

779{
780 return mVsbar->GetRange();
781}

References mVsbar.

◆ GetVerticalScrollBar()

wxScrollBar & ProjectWindow::GetVerticalScrollBar ( )
inline

Definition at line 121 of file ProjectWindow.h.

121{ return *mVsbar; }

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetVerticalThumbPosition()

int ProjectWindow::GetVerticalThumbPosition ( ) const

Definition at line 768 of file ProjectWindow.cpp.

769{
770 return mVsbar->GetThumbPosition();
771}

References mVsbar.

◆ GetVerticalThumbSize()

int ProjectWindow::GetVerticalThumbSize ( ) const

Definition at line 773 of file ProjectWindow.cpp.

774{
775 return mVsbar->GetThumbSize();
776}

References mVsbar.

◆ IsActive()

bool ProjectWindow::IsActive ( )
override

Definition at line 1222 of file ProjectWindow.cpp.

1223{
1224 return mActive;
1225}

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 847 of file ProjectWindow.cpp.

848{
849 return mIconized;
850}

References mIconized.

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

Here is the caller graph for this function:

◆ IsTrackMinimized()

bool ProjectWindow::IsTrackMinimized ( const Track track)

Definition at line 706 of file ProjectWindow.cpp.

707{
708 return ChannelView::Get(*track.GetChannel(0)).GetMinimized();
709}
std::shared_ptr< ChannelType > GetChannel(size_t iChannel)
Retrieve a channel, cast to the given type.
Definition: Channel.h:320
static ChannelView & Get(Channel &channel)
bool GetMinimized() const
Definition: ChannelView.h:69

References ChannelView::Get(), ChannelGroup::GetChannel(), and ChannelView::GetMinimized().

Here is the call graph for this function:

◆ MacShowUndockedToolbars()

void ProjectWindow::MacShowUndockedToolbars ( bool  show)

Definition at line 977 of file ProjectWindow.cpp.

978{
979 (void)show;//compiler food
980#ifdef __WXMAC__
981 // Save the focus so we can restore it to whatever had it before since
982 // showing a previously hidden toolbar will cause the focus to be set to
983 // its frame. If this is not done it will appear that activation events
984 // aren't being sent to the project window since they are actually being
985 // delivered to the last tool frame shown.
986 wxWindow *focused = FindFocus();
987
988 // Find all the floating toolbars, and show or hide them
989 const auto &children = GetChildren();
990 for(const auto &child : children) {
991 if (auto frame = dynamic_cast<ToolFrame*>(child)) {
992 if (!show) {
993 frame->Hide();
994 }
995 else if (frame->GetBar() &&
996 frame->GetBar()->IsVisible() ) {
997 frame->Show();
998 }
999 }
1000 }
1001
1002 // Restore the focus if needed
1003 if (focused) {
1004 focused->SetFocus();
1005 }
1006#endif
1007}
class ToolFrame
Definition: ToolManager.h:189
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.
Definition: BasicUI.h:375

References BasicUI::FindFocus().

Referenced by OnIconize().

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

◆ MinimumTrackHeight()

unsigned ProjectWindow::MinimumTrackHeight ( )

Definition at line 701 of file ProjectWindow.cpp.

702{
704}
AUDACITY_DLL_API unsigned MinimumTrackHeight()

References CommonTrackInfo::MinimumTrackHeight().

Here is the call graph for this function:

◆ NextWindowID()

int ProjectWindow::NextWindowID ( )

Definition at line 430 of file ProjectWindow.cpp.

431{
432 return mNextWindowID++;
433}

References mNextWindowID.

◆ OnActivate()

void ProjectWindow::OnActivate ( wxActivateEvent &  event)

Definition at line 1187 of file ProjectWindow.cpp.

1188{
1189 // Activate events can fire during window teardown, so just
1190 // ignore them.
1191 if (IsBeingDeleted()) {
1192 return;
1193 }
1194
1195 auto pProject = FindProject();
1196 if (!pProject)
1197 return;
1198 auto &project = *pProject;
1199
1200 mActive = event.GetActive();
1201
1202 // Under Windows, focus can be "lost" when returning to
1203 // Audacity from a different application.
1204 //
1205 // This was observed by minimizing all windows using WINDOWS+M and
1206 // then ALT+TAB to return to Audacity. Focus will be given to the
1207 // project window frame which is not at all useful.
1208 //
1209 // So, we use ToolManager's observation of focus changes in a wxEventFilter.
1210 // Then, when we receive the
1211 // activate event, we restore that focus to the child or the track
1212 // panel if no child had the focus (which probably should never happen).
1213 if (mActive) {
1214 auto &toolManager = ToolManager::Get( project );
1216 if ( ! toolManager.RestoreFocus() )
1217 GetProjectPanel( project ).SetFocus();
1218 }
1219 event.Skip();
1220}
void SetActiveProject(AudacityProject *project)
AUDACITY_DLL_API wxWindow & GetProjectPanel(AudacityProject &project)
Get the main sub-window of the project frame that displays track data.
bool IsBeingDeleted() const
Definition: ProjectWindow.h:56
static ToolManager & Get(AudacityProject &project)

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

Here is the call graph for this function:

◆ OnIconize()

void ProjectWindow::OnIconize ( wxIconizeEvent &  event)

Definition at line 1009 of file ProjectWindow.cpp.

1010{
1011 //JKC: On Iconizing we get called twice. Don't know
1012 // why but it does no harm.
1013 // Should we be returning true/false rather than
1014 // void return? I don't know.
1015 mIconized = event.IsIconized();
1016
1017#if defined(__WXMAC__)
1018 // Readdresses bug 1431 since a crash could occur when restoring iconized
1019 // floating toolbars due to recursion (bug 2411).
1021 if( !mIconized )
1022 {
1023 Raise();
1024 }
1025#endif
1026
1027 // VisibileProjectCount seems to be just a counter for debugging.
1028 // It's not used outside this function.
1029 auto VisibleProjectCount = std::count_if(
1031 []( const AllProjects::value_type &ptr ){
1032 return !GetProjectFrame( *ptr ).IsIconized();
1033 }
1034 );
1035 event.Skip();
1036
1037 // This step is to fix part of Bug 2040, where the BackingPanel
1038 // size was not restored after we leave Iconized state.
1039
1040 // Queue up a resize event using OnShow so that we
1041 // refresh the track panel. But skip this, if we're iconized.
1042 if( mIconized )
1043 return;
1044 wxShowEvent Evt;
1045 OnShow( Evt );
1046}
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:57
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 1146 of file ProjectWindow.cpp.

1147{
1148#ifdef __WXMSW__
1149 // Bug 1642: We can arrive here with bogus menu IDs, which we
1150 // proceed to process. So if bogus, don't.
1151 // The bogus menu IDs are probably generated by controls on the TrackPanel,
1152 // such as the Project Rate.
1153 // 17000 is the magic number at which we start our menu.
1154 // This code would probably NOT be OK on Mac, since we assign
1155 // some specific ID numbers.
1156 if( event.GetId() < 17000){
1157 event.Skip();
1158 return;
1159 }
1160#endif
1161 auto pProject = FindProject();
1162 if (!pProject)
1163 return;
1164 auto &project = *pProject;
1165 auto &commandManager = CommandManager::Get( project );
1166 bool handled = commandManager.HandleMenuID(
1167 event.GetId(), CommandManager::Get( project ).GetUpdateFlags(),
1168 false);
1169
1170 if (handled)
1171 event.Skip(false);
1172 else{
1173 event.ResumePropagation( 999 );
1174 event.Skip(true);
1175 }
1176}
static CommandManager & Get(AudacityProject &project)
CommandFlag GetUpdateFlags(bool quick=false) const

References ProjectWindowBase::FindProject(), CommandManager::Get(), CommandManager::GetUpdateFlags(), and project.

Here is the call graph for this function:

◆ OnMouseEvent()

void ProjectWindow::OnMouseEvent ( wxMouseEvent &  event)

Definition at line 1227 of file ProjectWindow.cpp.

1228{
1229 auto pProject = FindProject();
1230 if (!pProject)
1231 return;
1232 auto &project = *pProject;
1233 if (event.ButtonDown())
1235}

References ProjectWindowBase::FindProject(), project, and SetActiveProject().

Here is the call graph for this function:

◆ OnMove()

void ProjectWindow::OnMove ( wxMoveEvent &  event)

Definition at line 1048 of file ProjectWindow.cpp.

1049{
1050 if (!this->IsMaximized() && !this->IsIconized())
1051 SetNormalizedWindowState(this->GetRect());
1052 event.Skip();
1053}
void SetNormalizedWindowState(wxRect pSizeAndLocation)
bool IsIconized() const override

References IsIconized(), and SetNormalizedWindowState().

Here is the call graph for this function:

◆ OnProjectTitleChange()

void ProjectWindow::OnProjectTitleChange ( ProjectFileIOMessage  message)

Definition at line 1123 of file ProjectWindow.cpp.

1124{
1126 auto pProject = FindProject();
1127 if (!pProject)
1128 return;
1129 auto &project = *pProject;
1131 if (name != GetTitle()) {
1132 SetTitle(name);
1133 SetName(name); // to make the nvda screen reader read the correct title
1134 }
1135 }
1136}
const TranslatableString name
Definition: Distortion.cpp:76
const wxString & GetProjectTitle() const
Definition: ProjectFileIO.h:96

References ProjectWindowBase::FindProject(), ProjectFileIO::Get(), ProjectFileIO::GetProjectTitle(), name, project, and ProjectTitleChange.

Referenced by ProjectWindow().

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 1138 of file ProjectWindow.cpp.

1139{
1140 auto pProject = FindProject();
1141 if (!pProject)
1142 return;
1143 Viewport::Get(*pProject).OnScroll();
1144}
void OnScroll()
Definition: Viewport.cpp:399

References ProjectWindowBase::FindProject(), Viewport::Get(), and Viewport::OnScroll().

Here is the call graph for this function:

◆ OnScrollLeftButton()

void ProjectWindow::OnScrollLeftButton ( wxScrollEvent &  event)

Definition at line 673 of file ProjectWindow.cpp.

674{
675 auto pProject = FindProject();
676 if (!pProject)
677 return;
679}
void OnScrollLeftButton()
Definition: Viewport.cpp:144

References ProjectWindowBase::FindProject(), Viewport::Get(), and Viewport::OnScrollLeftButton().

Here is the call graph for this function:

◆ OnScrollRightButton()

void ProjectWindow::OnScrollRightButton ( wxScrollEvent &  event)

Definition at line 681 of file ProjectWindow.cpp.

682{
683 auto pProject = FindProject();
684 if (!pProject)
685 return;
687}
void OnScrollRightButton()
Definition: Viewport.cpp:161

References ProjectWindowBase::FindProject(), Viewport::Get(), and Viewport::OnScrollRightButton().

Here is the call graph for this function:

◆ OnShow()

void ProjectWindow::OnShow ( wxShowEvent &  event)

Definition at line 1075 of file ProjectWindow.cpp.

1076{
1077 // Remember that the window has been shown at least once
1078 mShownOnce = true;
1079
1080 // (From Debian...see also TrackPanel::OnTimer and AudacityTimer::Notify)
1081 //
1082 // Description: Workaround for wxWidgets bug: Reentry in clipboard
1083 // The wxWidgets bug http://trac.wxwidgets.org/ticket/16636 prevents
1084 // us from doing clipboard operations in wxShowEvent and wxTimerEvent
1085 // processing because those event could possibly be processed during
1086 // the (not sufficiently protected) Yield() of a first clipboard
1087 // operation, causing reentry. Audacity had a workaround in place
1088 // for this problem (the class "CaptureEvents"), which however isn't
1089 // applicable with wxWidgets 3.0 because it's based on changing the
1090 // gdk event handler, a change that would be overridden by wxWidgets's
1091 // own gdk event handler change.
1092 // Instead, as a NEW workaround, specifically protect those processings
1093 // of wxShowEvent and wxTimerEvent that try to do clipboard operations
1094 // from being executed within Yield(). This is done by delaying their
1095 // execution by posting pure wxWidgets events - which are never executed
1096 // during Yield().
1097 // Author: Martin Stegh fer <[email protected]>
1098 // Bug-Debian: https://bugs.debian.org/765341
1099
1100 // the actual creation/showing of the window).
1101 // Post the event instead of calling OnSize(..) directly. This ensures that
1102 // this is a pure wxWidgets event (no GDK event behind it) and that it
1103 // therefore isn't processed within the YieldFor(..) of the clipboard
1104 // operations (workaround for Debian bug #765341).
1105 // QueueEvent() will take ownership of the event
1106 GetEventHandler()->QueueEvent(safenew wxSizeEvent(GetSize()));
1107
1108 // Further processing by default handlers
1109 event.Skip();
1110}

References mShownOnce, and safenew.

Referenced by OnIconize().

Here is the caller graph for this function:

◆ OnSize()

void ProjectWindow::OnSize ( wxSizeEvent &  event)

Definition at line 1055 of file ProjectWindow.cpp.

1056{
1057 // (From Debian)
1058 //
1059 // (3.) GTK critical warning "IA__gdk_window_get_origin: assertion
1060 // 'GDK_IS_WINDOW (window)' failed": Received events of type wxSizeEvent
1061 // on the main project window cause calls to "ClientToScreen" - which is
1062 // not available until the window is first shown. So the class has to
1063 // keep track of wxShowEvent events and inhibit those actions until the
1064 // window is first shown.
1065 if (mShownOnce) {
1066 auto pProject = FindProject();
1067 if (pProject)
1068 Viewport::Get(*pProject).HandleResize();
1069 if (!this->IsMaximized() && !this->IsIconized())
1070 SetNormalizedWindowState(this->GetRect());
1071 }
1072 event.Skip();
1073}
void HandleResize()
Definition: Viewport.cpp:389

References ProjectWindowBase::FindProject(), Viewport::Get(), Viewport::HandleResize(), IsIconized(), mShownOnce, and SetNormalizedWindowState().

Here is the call graph for this function:

◆ OnThemeChange()

void ProjectWindow::OnThemeChange ( struct ThemeChangeMessage  message)
private

Definition at line 648 of file ProjectWindow.cpp.

649{
650 auto pProject = FindProject();
651 if (!pProject)
652 return;
653 auto &project = *pProject;
654
655 if (message.appearance)
656 return;
657 this->ApplyUpdatedTheme();
658 auto &toolManager = ToolManager::Get( project );
659 toolManager.ForEach([](auto pToolBar){
660 if( pToolBar )
661 pToolBar->ReCreateButtons();
662 });
663}
void ApplyUpdatedTheme()
std::optional< PreferredSystemAppearance > appearance
Definition: Theme.h:111

References ThemeChangeMessage::appearance, ApplyUpdatedTheme(), ProjectWindowBase::FindProject(), ToolManager::Get(), and project.

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 1115 of file ProjectWindow.cpp.

1116{
1117 auto pProject = FindProject();
1118 if (pProject)
1119 Viewport::Get(*pProject).HandleResize();
1120 event.Skip(false); /* No need to propagate any further */
1121}

References ProjectWindowBase::FindProject(), Viewport::Get(), and Viewport::HandleResize().

Here is the call graph for this function:

◆ OnUpdateUI()

void ProjectWindow::OnUpdateUI ( wxUpdateUIEvent &  event)

Definition at line 1178 of file ProjectWindow.cpp.

1179{
1180 auto pProject = FindProject();
1181 if (!pProject)
1182 return;
1183 auto &project = *pProject;
1185}
void UpdateMenus(bool checkActive=true)

References ProjectWindowBase::FindProject(), CommandManager::Get(), project, and CommandManager::UpdateMenus().

Here is the call graph for this function:

◆ OnViewportMessage()

void ProjectWindow::OnViewportMessage ( const ViewportMessage message)
private

Definition at line 1292 of file ProjectWindow.cpp.

1293{
1294 // Activate events can fire during window teardown, so just
1295 // ignore them.
1296 if (mIsDeleting)
1297 return;
1298 auto pProject = FindProject();
1299 if (!pProject)
1300 return;
1301 auto &project = *pProject;
1302 auto &viewInfo = ViewInfo::Get(project);
1303 auto &trackPanel = GetProjectPanel(project);
1304
1305 auto [rescroll, scrollbarVisibilityChanged, resize] = message;
1306
1307 if (rescroll)
1308 trackPanel.Refresh(false);
1309
1310 // why? Is there a menu item whose availability depends on scroll position
1311 // or zoom level?
1313
1314 if (scrollbarVisibilityChanged || resize)
1315 UpdateLayout();
1316}
static ViewInfo & Get(AudacityProject &project)
Definition: ViewInfo.cpp:235

References ProjectWindowBase::FindProject(), CommandManager::Get(), ViewInfo::Get(), GetProjectPanel(), mIsDeleting, project, UpdateLayout(), and CommandManager::UpdateMenus().

Here is the call graph for this function:

◆ RefreshTPTrack()

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

◆ SetChannelHeights()

void ProjectWindow::SetChannelHeights ( Track track,
unsigned  height 
)

Definition at line 727 of file ProjectWindow.cpp.

728{
729 for (auto pChannel : track.Channels())
730 ChannelView::Get(*pChannel).SetExpandedHeight(height);
731}
IteratorRange< ChannelIterator< ChannelType > > Channels()
Get range of channels with mutative access.
Definition: Channel.h:381
void SetExpandedHeight(int height)

References ChannelGroup::Channels(), ChannelView::Get(), and ChannelView::SetExpandedHeight().

Here is the call graph for this function:

◆ SetHorizontalScrollbar()

void ProjectWindow::SetHorizontalScrollbar ( int  position,
int  thumbSize,
int  range,
int  pageSize,
bool  refresh 
)

Definition at line 753 of file ProjectWindow.cpp.

755{
756 mHsbar->SetScrollbar(position, thumbSize, range, pageSize, refresh);
757}

References mHsbar.

◆ SetHorizontalThumbPosition()

void ProjectWindow::SetHorizontalThumbPosition ( int  viewStart)

Definition at line 748 of file ProjectWindow.cpp.

749{
750 mHsbar->SetThumbPosition(viewStart);
751}

References mHsbar.

◆ SetIsBeingDeleted()

void ProjectWindow::SetIsBeingDeleted ( )
inline

Definition at line 57 of file ProjectWindow.h.

57{ mIsDeleting = true; }

◆ SetMinimized()

void ProjectWindow::SetMinimized ( Track track,
bool  minimized 
)

Definition at line 711 of file ProjectWindow.cpp.

712{
713 for (auto pChannel : track.Channels())
714 ChannelView::Get(*pChannel).SetMinimized(minimized);
715}
void SetMinimized(bool minimized)

References ChannelGroup::Channels(), ChannelView::Get(), and ChannelView::SetMinimized().

Here is the call graph for this function:

◆ SetNormalizedWindowState()

void ProjectWindow::SetNormalizedWindowState ( wxRect  pSizeAndLocation)
inline

Definition at line 113 of file ProjectWindow.h.

113{ mNormalizedWindowState = pSizeAndLocation; }

Referenced by OnMove(), and OnSize().

Here is the caller graph for this function:

◆ SetToDefaultSize()

void ProjectWindow::SetToDefaultSize ( )

Definition at line 867 of file ProjectWindow.cpp.

868{
869 wxRect defaultRect;
870 GetDefaultWindowRect(&defaultRect);
871
872 SetSize(defaultRect.width, defaultRect.height);
873}
void GetDefaultWindowRect(wxRect *defRect)

References GetDefaultWindowRect().

Here is the call graph for this function:

◆ SetVerticalScrollbar()

void ProjectWindow::SetVerticalScrollbar ( int  position,
int  thumbSize,
int  range,
int  pageSize,
bool  refresh 
)

Definition at line 788 of file ProjectWindow.cpp.

790{
791 mVsbar->SetScrollbar(position, thumbSize, range, pageSize, refresh);
792}

References mVsbar.

◆ SetVerticalThumbPosition()

void ProjectWindow::SetVerticalThumbPosition ( int  viewStart)

Definition at line 783 of file ProjectWindow.cpp.

784{
785 mVsbar->SetThumbPosition(viewStart);
786}

References mVsbar.

◆ ShowHorizontalScrollbar()

void ProjectWindow::ShowHorizontalScrollbar ( bool  shown)

Definition at line 759 of file ProjectWindow.cpp.

760{
761#ifdef __WXGTK__
762 mHsbar->Show(shown);
763#else
764 mHsbar->Enable(shown);
765#endif
766}

References mHsbar.

◆ ShowVerticalScrollbar()

void ProjectWindow::ShowVerticalScrollbar ( bool  shown)

Definition at line 794 of file ProjectWindow.cpp.

795{
796#ifdef __WXGTK__
797 mVsbar->Show(shown);
798#else
799 mVsbar->Enable(shown);
800#endif
801}

References mVsbar.

◆ UpdateLayout()

void ProjectWindow::UpdateLayout ( )

Definition at line 803 of file ProjectWindow.cpp.

804{
805 auto pProject = FindProject();
806 if (!pProject)
807 return;
808 auto &project = *pProject;
809 auto &trackPanel = GetProjectPanel( project );
810 auto &toolManager = ToolManager::Get( project );
811
812 // 1. Layout panel, to get widths of the docks.
813 Layout();
814 // 2. Layout toolbars to pack the toolbars correctly in docks which
815 // are now the correct width.
816 toolManager.LayoutToolBars();
817 // 3. Layout panel, to resize docks, in particular reducing the height
818 // of any empty docks, or increasing the height of docks that need it.
819 Layout();
820
821 // Bug 2455
822 // The commented out code below is to calculate a nice minimum size for
823 // the window. However on Ubuntu when the window is minimised it leads to
824 // an insanely tall window.
825 // Using a fixed min size fixes that.
826 // However there is still something strange when minimised, as once
827 // UpdateLayout is called once, when minimised, it gets called repeatedly.
828#if 0
829 // Retrieve size of this projects window
830 wxSize mainsz = GetSize();
831
832 // Retrieve position of the track panel to use as the size of the top
833 // third of the window
834 wxPoint tppos = ClientToScreen(trackPanel.GetParent()->GetPosition());
835
836 // Retrieve position of bottom dock to use as the size of the bottom
837 // third of the window
838 wxPoint sbpos = ClientToScreen(toolManager.GetBotDock()->GetPosition());
839
840 // The "+ 50" is the minimum height of the TrackPanel
841 SetMinSize( wxSize(250, (mainsz.y - sbpos.y) + tppos.y + 50));
842#endif
843 SetMinSize( wxSize(250, 250));
844 SetMaxSize( wxSize(20000, 20000));
845}

References ProjectWindowBase::FindProject(), ToolManager::Get(), GetProjectPanel(), and project.

Referenced by OnViewportMessage().

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 665 of file ProjectWindow.cpp.

666{
667 // Update status bar widths in case of language change
669}
void UpdateStatusWidths()

References UpdateStatusWidths().

Here is the call graph for this function:

◆ UpdateStatusWidths()

void ProjectWindow::UpdateStatusWidths ( )

Definition at line 920 of file ProjectWindow.cpp.

921{
922 auto pProject = FindProject();
923 if (!pProject)
924 return;
925
926 const auto fieldsCount =
927 ProjectStatusFieldsRegistry::Count(pProject.get()) + 1;
928 auto statusBar = GetStatusBar();
929
930 bool statusBarRecreated = false;
931
932 if (!statusBar || fieldsCount != statusBar->GetFieldsCount())
933 {
934 statusBar = CreateProjectStatusBar();
935 statusBarRecreated = true;
936 }
937
938 const auto& functions = ProjectStatus::GetStatusWidthFunctions();
939
940 auto& project = *pProject;
941
942 std::vector<int> widths(fieldsCount, 0);
943
944 // The old behavior with zero-width first field is kept
945 int index = 1;
946
948 [&](const StatusBarFieldItem& field, const auto&)
949 {
950 if (!field.IsVisible(project))
951 return;
952
953 auto width = field.GetDefaultWidth(project);
954
955 // Negative width indicates that the field is expandable
956 if (width >= 0)
957 {
958 for (const auto& function : functions)
959 {
960 auto results = function(project, field.name);
961 for (const auto& string : results.first)
962 {
963 int w;
964 statusBar->GetTextExtent(string.Translation(), &w, nullptr);
965 width = std::max<int>(width, w + results.second);
966 }
967 }
968 }
969
970 widths[index++] = width;
971 });
972
973 statusBar->SetStatusWidths(fieldsCount, widths.data());
975}
static const StatusWidthFunctions & GetStatusWidthFunctions()
wxStatusBar * CreateProjectStatusBar()

References ProjectStatusFieldsRegistry::Count(), CreateProjectStatusBar(), field, ProjectWindowBase::FindProject(), ProjectStatus::GetStatusWidthFunctions(), ProjectStatusFieldsRegistry::OnSize(), project, and ProjectStatusFieldsRegistry::Visit().

Referenced by InitProjectWindow(), and UpdatePrefs().

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

◆ ViewportSize()

std::pair< int, int > ProjectWindow::ViewportSize ( ) const

Definition at line 689 of file ProjectWindow.cpp.

690{
691 auto pProject = FindProject();
692 if (!pProject)
693 return { 0, 0 };
694 auto &project = *pProject;
695 auto &trackPanel = TrackPanel::Get(project);
696 int width, height;
697 trackPanel.GetSize(&width, &height);
698 return { width, height };
699}
static TrackPanel & Get(AudacityProject &project)
Definition: TrackPanel.cpp:234

References ProjectWindowBase::FindProject(), TrackPanel::Get(), and project.

Here is the call graph for this function:

Member Data Documentation

◆ mActive

bool ProjectWindow::mActive { true }
private

Definition at line 195 of file ProjectWindow.h.

Referenced by IsActive(), and OnActivate().

◆ mContainerWindow

wxSplitterWindow* ProjectWindow::mContainerWindow
private

Definition at line 187 of file ProjectWindow.h.

Referenced by GetContainerWindow(), and ProjectWindow().

◆ mHsbar

wxScrollBar* ProjectWindow::mHsbar {}
private

◆ mIconized

bool ProjectWindow::mIconized { false }
private

Definition at line 196 of file ProjectWindow.h.

Referenced by IsIconized(), and OnIconize().

◆ mIsDeleting

bool ProjectWindow::mIsDeleting { false }
private

Definition at line 201 of file ProjectWindow.h.

Referenced by OnViewportMessage().

◆ mNextWindowID

int ProjectWindow::mNextWindowID {}
private

Definition at line 193 of file ProjectWindow.h.

Referenced by NextWindowID(), and ProjectWindow().

◆ mNormalizedWindowState

wxRect ProjectWindow::mNormalizedWindowState
private

Definition at line 184 of file ProjectWindow.h.

◆ mPlaybackScroller

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

Definition at line 211 of file ProjectWindow.h.

Referenced by ProjectWindow().

◆ mShownOnce

bool ProjectWindow::mShownOnce { false }
private

Definition at line 197 of file ProjectWindow.h.

Referenced by OnShow(), and OnSize().

◆ mSnappingChangedSubscription

Observer::Subscription ProjectWindow::mSnappingChangedSubscription
private

Definition at line 209 of file ProjectWindow.h.

◆ mThemeChangeSubscription

Observer::Subscription ProjectWindow::mThemeChangeSubscription
private

Definition at line 207 of file ProjectWindow.h.

Referenced by ProjectWindow().

◆ mTitleChangeSubscription

Observer::Subscription ProjectWindow::mTitleChangeSubscription
private

Definition at line 208 of file ProjectWindow.h.

Referenced by ProjectWindow().

◆ mTopPanel

wxPanel* ProjectWindow::mTopPanel {}
private

Definition at line 186 of file ProjectWindow.h.

Referenced by GetTopPanel(), and ProjectWindow().

◆ mTrackListWindow

wxWindow* ProjectWindow::mTrackListWindow {}
private

Definition at line 188 of file ProjectWindow.h.

Referenced by GetTrackListWindow(), and ProjectWindow().

◆ mViewportSubscription

const Observer::Subscription ProjectWindow::mViewportSubscription
private

Definition at line 212 of file ProjectWindow.h.

◆ mVsbar

wxScrollBar* ProjectWindow::mVsbar {}
private

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