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

529 : ProjectWindowBase{ parent, id, pos, size, project }
533{
534 Viewport::Get(project).SetCallbacks(std::make_unique<Adapter>(*this));
535
537
538 constexpr auto EffectsPanelMaxWidth { 500 };
539 constexpr auto TrackPanelMinWidth { 250 };
540
541 // Two sub-windows need to be made before Init(),
542 // so that this constructor can complete, and then TrackPanel and
543 // AdornedRulerPanel can retrieve those windows from this in their
544 // factory functions
545
546 // PRL: this panel groups the top tool dock and the ruler into one
547 // tab cycle.
548 // Must create it with non-default width equal to the main window width,
549 // or else the device toolbar doesn't make initial widths of the choice
550 // controls correct.
552 this, wxID_ANY, wxDefaultPosition,
553 wxSize{ this->GetSize().GetWidth(), -1 }
554 };
555 mTopPanel->SetLabel( "Top Panel" );// Not localised
556 mTopPanel->SetLayoutDirection(wxLayout_LeftToRight);
557 mTopPanel->SetAutoLayout(true);
558
559 auto container = safenew wxSplitterWindow(this, wxID_ANY,
560 wxDefaultPosition,
561 wxDefaultSize,
562 wxNO_BORDER | wxSP_LIVE_UPDATE | wxSP_THIN_SASH);
563 container->Bind(wxEVT_SPLITTER_DOUBLECLICKED, [](wxSplitterEvent& event){
564 //"The default behaviour is to unsplit the window"
565 event.Veto();//do noting instead
566 });
567 container->Bind(wxEVT_SPLITTER_SASH_POS_CHANGING, [=](wxSplitterEvent& event){
568 if(event.GetSashPosition() > EffectsPanelMaxWidth)
569 //Prevents left panel from expanding further
570 event.SetSashPosition(-1);
571 });
572 mContainerWindow = container;
573
575 wxDefaultPosition,
576 wxDefaultSize,
577 wxNO_BORDER);
578 mTrackListWindow->SetMinSize({TrackPanelMinWidth, -1});
579 mTrackListWindow->SetSizer( safenew wxBoxSizer(wxVERTICAL) );
580 mTrackListWindow->SetLabel("Main Panel");// Not localized.
581 mTrackListWindow->SetLayoutDirection(wxLayout_LeftToRight);
582
584
585 mPlaybackScroller = std::make_unique<PlaybackScroller>( &project );
586
587 // PRL: Old comments below. No longer observing the ordering that it
588 // recommends. ProjectWindow::OnActivate puts the focus directly into
589 // the TrackPanel, which avoids the problems.
590 // LLL: When Audacity starts or becomes active after returning from
591 // another application, the first window that can accept focus
592 // will be given the focus even if we try to SetFocus(). By
593 // creating the scrollbars after the TrackPanel, we resolve
594 // several focus problems.
595
596 mHsbar = safenew ScrollBar(mTrackListWindow, HSBarID, wxSB_HORIZONTAL);
597 mVsbar = safenew ScrollBar(mTrackListWindow, VSBarID, wxSB_VERTICAL);
598#if wxUSE_ACCESSIBILITY
599 // so that name can be set on a standard control
600 mHsbar->SetAccessible(safenew WindowAccessible(mHsbar));
601 mVsbar->SetAccessible(safenew WindowAccessible(mVsbar));
602#endif
603 mHsbar->SetLayoutDirection(wxLayout_LeftToRight);
604 mHsbar->SetName(_("Horizontal Scrollbar"));
605 mVsbar->SetName(_("Vertical Scrollbar"));
606
609
610 // Subscribe to title changes published by ProjectFileIO
613
614 // And also establish my initial consistency with it
616}
#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 618 of file ProjectWindow.cpp.

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

Member Function Documentation

◆ ApplyUpdatedTheme()

void ProjectWindow::ApplyUpdatedTheme ( )

Definition at line 644 of file ProjectWindow.cpp.

645{
646 SetBackgroundColour(theTheme.Colour( clrMedium ));
647 ClearBackground();// For wxGTK.
648}
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 877 of file ProjectWindow.cpp.

878{
879 auto statusBar = GetStatusBar();
880
881 if (statusBar != nullptr)
882 statusBar->Destroy();
883
884 auto pProject = FindProject();
885
886 // Note that the first field of the status bar is a dummy, and its width is
887 // set to zero latter in the code. This field is needed for wxWidgets 2.8.12
888 // because if you move to the menu bar, the first field of the menu bar is
889 // cleared, which is undesirable behaviour. In addition, the help strings of
890 // menu items are by default sent to the first field. Currently there are no
891 // such help strings, but it they were introduced, then there would need to
892 // be an event handler to send them to the appropriate field.
893 statusBar = CreateStatusBar(
894 1 + ProjectStatusFieldsRegistry::Count(pProject.get()));
895
896 statusBar->Bind(
897 wxEVT_SIZE,
898 [this](auto& evt)
899 {
900 evt.Skip();
901 auto pProject = FindProject();
902 if (pProject != nullptr)
904 });
905
906 // We have a new status bar now, we need a full content update
907 if (pProject)
908 {
909 int index = 1;
911 [&](const StatusBarFieldItem& field, const auto&)
912 {
913 if (field.IsVisible(*pProject))
914 statusBar->SetStatusText(
915 field.GetText(*pProject).Translation(), index++);
916 });
917 }
918
919 return statusBar;
920}
#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 AdornedRulerPanel::DoIdle(), 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 859 of file ProjectWindow.cpp.

860{
861 return mContainerWindow;
862}

References mContainerWindow.

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetHorizontalRange()

int ProjectWindow::GetHorizontalRange ( ) const

Definition at line 745 of file ProjectWindow.cpp.

746{
747 return mHsbar->GetRange();
748}

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

736{
737 return mHsbar->GetThumbPosition();
738}

References mHsbar.

◆ GetHorizontalThumbSize()

int ProjectWindow::GetHorizontalThumbSize ( ) const

Definition at line 740 of file ProjectWindow.cpp.

741{
742 return mHsbar->GetThumbSize();
743}

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

865{
866 return mTopPanel;
867}

References mTopPanel.

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetTotalHeight()

int ProjectWindow::GetTotalHeight ( const TrackList trackList)

Definition at line 724 of file ProjectWindow.cpp.

725{
726 return ChannelView::GetTotalHeight(trackList);
727}
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 719 of file ProjectWindow.cpp.

720{
722}
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 854 of file ProjectWindow.cpp.

855{
856 return mTrackListWindow;
857}

References mTrackListWindow.

Referenced by InitProjectWindow().

Here is the caller graph for this function:

◆ GetVerticalRange()

int ProjectWindow::GetVerticalRange ( ) const

Definition at line 780 of file ProjectWindow.cpp.

781{
782 return mVsbar->GetRange();
783}

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

771{
772 return mVsbar->GetThumbPosition();
773}

References mVsbar.

◆ GetVerticalThumbSize()

int ProjectWindow::GetVerticalThumbSize ( ) const

Definition at line 775 of file ProjectWindow.cpp.

776{
777 return mVsbar->GetThumbSize();
778}

References mVsbar.

◆ IsActive()

bool ProjectWindow::IsActive ( )
override

Definition at line 1224 of file ProjectWindow.cpp.

1225{
1226 return mActive;
1227}

References mActive.

◆ IsBeingDeleted()

bool ProjectWindow::IsBeingDeleted ( ) const
inline

Definition at line 56 of file ProjectWindow.h.

56{ return mIsDeleting; }

Referenced by anonymous_namespace{ProjectWindow.cpp}::IsWindowValid(), and OnActivate().

Here is the caller graph for this function:

◆ IsIconized()

bool ProjectWindow::IsIconized ( ) const
override

Definition at line 849 of file ProjectWindow.cpp.

850{
851 return mIconized;
852}

References mIconized.

Referenced by AdornedRulerPanel::DoIdle(), GetNextWindowPlacement(), OnMove(), and OnSize().

Here is the caller graph for this function:

◆ IsTrackMinimized()

bool ProjectWindow::IsTrackMinimized ( const Track track)

Definition at line 708 of file ProjectWindow.cpp.

709{
710 return ChannelView::Get(*track.GetChannel(0)).GetMinimized();
711}
std::shared_ptr< ChannelType > GetChannel(size_t iChannel)
Retrieve a channel, cast to the given type.
Definition: Channel.h:323
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 979 of file ProjectWindow.cpp.

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

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

704{
706}
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 1189 of file ProjectWindow.cpp.

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

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

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

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

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

Here is the call graph for this function:

◆ OnMove()

void ProjectWindow::OnMove ( wxMoveEvent &  event)

Definition at line 1050 of file ProjectWindow.cpp.

1051{
1052 if (!this->IsMaximized() && !this->IsIconized())
1053 SetNormalizedWindowState(this->GetRect());
1054 event.Skip();
1055}
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 1125 of file ProjectWindow.cpp.

1126{
1128 auto pProject = FindProject();
1129 if (!pProject)
1130 return;
1131 auto &project = *pProject;
1133 if (name != GetTitle()) {
1134 SetTitle(name);
1135 SetName(name); // to make the nvda screen reader read the correct title
1136 }
1137 }
1138}
wxString name
Definition: TagsEditor.cpp:166
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 1140 of file ProjectWindow.cpp.

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

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

676{
677 auto pProject = FindProject();
678 if (!pProject)
679 return;
681}
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 683 of file ProjectWindow.cpp.

684{
685 auto pProject = FindProject();
686 if (!pProject)
687 return;
689}
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 1077 of file ProjectWindow.cpp.

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

References mShownOnce, and safenew.

Referenced by OnIconize().

Here is the caller graph for this function:

◆ OnSize()

void ProjectWindow::OnSize ( wxSizeEvent &  event)

Definition at line 1057 of file ProjectWindow.cpp.

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

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

651{
652 auto pProject = FindProject();
653 if (!pProject)
654 return;
655 auto &project = *pProject;
656
657 if (message.appearance)
658 return;
659 this->ApplyUpdatedTheme();
660 auto &toolManager = ToolManager::Get( project );
661 toolManager.ForEach([](auto pToolBar){
662 if( pToolBar )
663 pToolBar->ReCreateButtons();
664 });
665}
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 1117 of file ProjectWindow.cpp.

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

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

1181{
1182 auto pProject = FindProject();
1183 if (!pProject)
1184 return;
1185 auto &project = *pProject;
1187}
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 1294 of file ProjectWindow.cpp.

1295{
1296 // Activate events can fire during window teardown, so just
1297 // ignore them.
1298 if (mIsDeleting)
1299 return;
1300 auto pProject = FindProject();
1301 if (!pProject)
1302 return;
1303 auto &project = *pProject;
1304 auto &viewInfo = ViewInfo::Get(project);
1305 auto &trackPanel = GetProjectPanel(project);
1306
1307 auto [rescroll, scrollbarVisibilityChanged, resize] = message;
1308
1309 if (rescroll)
1310 trackPanel.Refresh(false);
1311
1312 // why? Is there a menu item whose availability depends on scroll position
1313 // or zoom level?
1315
1316 if (scrollbarVisibilityChanged || resize)
1317 UpdateLayout();
1318}
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 729 of file ProjectWindow.cpp.

730{
731 for (auto pChannel : track.Channels())
732 ChannelView::Get(*pChannel).SetExpandedHeight(height);
733}
IteratorRange< ChannelIterator< ChannelType > > Channels()
Get range of channels with mutative access.
Definition: Channel.h:384
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 755 of file ProjectWindow.cpp.

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

References mHsbar.

◆ SetHorizontalThumbPosition()

void ProjectWindow::SetHorizontalThumbPosition ( int  viewStart)

Definition at line 750 of file ProjectWindow.cpp.

751{
752 mHsbar->SetThumbPosition(viewStart);
753}

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

714{
715 for (auto pChannel : track.Channels())
716 ChannelView::Get(*pChannel).SetMinimized(minimized);
717}
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 869 of file ProjectWindow.cpp.

870{
871 wxRect defaultRect;
872 GetDefaultWindowRect(&defaultRect);
873
874 SetSize(defaultRect.width, defaultRect.height);
875}
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 790 of file ProjectWindow.cpp.

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

References mVsbar.

◆ SetVerticalThumbPosition()

void ProjectWindow::SetVerticalThumbPosition ( int  viewStart)

Definition at line 785 of file ProjectWindow.cpp.

786{
787 mVsbar->SetThumbPosition(viewStart);
788}

References mVsbar.

◆ ShowHorizontalScrollbar()

void ProjectWindow::ShowHorizontalScrollbar ( bool  shown)

Definition at line 761 of file ProjectWindow.cpp.

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

References mHsbar.

◆ ShowVerticalScrollbar()

void ProjectWindow::ShowVerticalScrollbar ( bool  shown)

Definition at line 796 of file ProjectWindow.cpp.

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

References mVsbar.

◆ UpdateLayout()

void ProjectWindow::UpdateLayout ( )

Definition at line 805 of file ProjectWindow.cpp.

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

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

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

References UpdateStatusWidths().

Here is the call graph for this function:

◆ UpdateStatusWidths()

void ProjectWindow::UpdateStatusWidths ( )

Definition at line 922 of file ProjectWindow.cpp.

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

692{
693 auto pProject = FindProject();
694 if (!pProject)
695 return { 0, 0 };
696 auto &project = *pProject;
697 auto &trackPanel = TrackPanel::Get(project);
698 int width, height;
699 trackPanel.GetSize(&width, &height);
700 return { width, height };
701}
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: