MCPcopy Create free account
hub / github.com/audacity/audacity / CreateProjectStatusBar

Method CreateProjectStatusBar

src/ProjectWindow.cpp:877–920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

875}
876
877wxStatusBar* ProjectWindow::CreateProjectStatusBar()
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)
903 ProjectStatusFieldsRegistry::OnSize(*pProject);
904 });
905
906 // We have a new status bar now, we need a full content update
907 if (pProject)
908 {
909 int index = 1;
910 ProjectStatusFieldsRegistry::Visit(
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}
921
922void ProjectWindow::UpdateStatusWidths()
923{

Callers 1

InitProjectWindowFunction · 0.80

Calls 11

OnSizeFunction · 0.85
BindMethod · 0.80
SkipMethod · 0.80
SetStatusTextMethod · 0.80
TranslationMethod · 0.80
CountFunction · 0.50
VisitFunction · 0.50
DestroyMethod · 0.45
getMethod · 0.45
IsVisibleMethod · 0.45
GetTextMethod · 0.45

Tested by

no test coverage detected