Audacity 3.2.0
Classes | Functions | Variables
BasicUI Namespace Reference

Classes

struct  ErrorDialogOptions
 Options for variations of error dialogs; the default is for modal dialogs. More...
 
class  GenericProgressDialog
 Abstraction of a progress dialog with undefined time-to-completion estimate. More...
 
struct  MessageBoxOptions
 
struct  Point
 A pair of screen coordinates, x increasing rightward, y downward. More...
 
class  ProgressDialog
 Abstraction of a progress dialog with well defined time-to-completion estimate. More...
 
class  Services
 Abstract class defines a few user interface services, not mentioning particular toolkits. More...
 
class  WindowPlacement
 Subclasses may hold information such as a parent window pointer for a dialog. More...
 

Functions

ServicesGet ()
 Fetch the global instance, or nullptr if none is yet installed. More...
 
ServicesInstall (Services *pInstance)
 Install an implementation; return the previously installed instance. More...
 
Functions that invoke global Services

These dispatch to the global Services, if supplied. If none was supplied, they are mostly no-ops, with exceptions as noted. All should be called on the main thread only, except as noted.

void CallAfter (Action action)
 Schedule an action to be done later, and in the main thread. More...
 
void Yield ()
 Dispatch waiting events, including actions enqueued by CallAfter. More...
 
bool OpenInDefaultBrowser (const wxString &url)
 Open an URL in default browser. More...
 
void ShowErrorDialog (const WindowPlacement &placement, const TranslatableString &dlogTitle, const TranslatableString &message, const ManualPageID &helpPage, const ErrorDialogOptions &options={})
 Show an error dialog with a link to the manual for further help. More...
 
MessageBoxResult ShowMessageBox (const TranslatableString &message, MessageBoxOptions options={})
 Show a modal message box with either Ok or Yes and No, and optionally Cancel. More...
 
std::unique_ptr< ProgressDialogMakeProgress (const TranslatableString &title, const TranslatableString &message, unsigned flags=(ProgressShowStop|ProgressShowCancel), const TranslatableString &remainingLabelText={})
 Create and display a progress dialog. More...
 
std::unique_ptr< GenericProgressDialogMakeGenericProgress (const WindowPlacement &placement, const TranslatableString &title, const TranslatableString &message, int style=(ProgressAppModal|ProgressShowElapsedTime|ProgressSmooth))
 Create and display a progress dialog (return nullptr if Services not installed) More...
 
template<typename ItType , typename FnType >
void SplitProgress (ItType first, ItType last, FnType action, ProgressReporter parent)
 Helper for the update of a task's progress bar when this task is made of a range's subtasks. More...
 
int ShowMultiDialog (const TranslatableString &message, const TranslatableString &title, const TranslatableStrings &buttons, const ManualPageID &helpPage, const TranslatableString &boxMsg, bool log)
 Display a dialog with radio buttons. More...
 
std::unique_ptr< WindowPlacementFindFocus ()
 Find the window that is accepting keyboard input, if any. More...
 
void SetFocus (const WindowPlacement &focus)
 Set the window that accepts keyboard input. More...
 
bool IsUsingRtlLayout ()
 Whether using a right-to-left language layout. More...
 
bool IsUiThread ()
 Whether the current thread is the UI thread. More...
 

Variables

static ServicestheInstance = nullptr
 
static std::recursive_mutex sActionsMutex
 
static std::vector< ActionsActions
 

Types used in the Services interface

enum class  ErrorDialogType { ModelessError , ModalError , ModalErrorReport }
 
enum class  Icon {
  None , Warning , Error , Question ,
  Information
}
 
enum class  Button { Default , Ok , YesNo }
 
enum class  MessageBoxResult : int {
  None , Yes , No , Ok ,
  Cancel
}
 
enum  ProgressDialogOptions : unsigned { ProgressShowStop = (1 << 0) , ProgressShowCancel = (1 << 1) , ProgressHideTime = (1 << 2) , ProgressConfirmStopOrCancel = (1 << 3) }
 
enum  GenericProgressDialogStyle : int { ProgressCanAbort = (1 << 0) , ProgressAppModal = (1 << 1) , ProgressShowElapsedTime = (1 << 2) , ProgressSmooth = (1 << 3) }
 
enum class  ProgressResult : unsigned { Cancelled = 0 , Success , Failed , Stopped }
 
using Action = std::function< void()>
 
using ProgressReporter = std::function< void(double)>
 
TranslatableString DefaultCaption ()
 "Message", suitably translated More...
 

Typedef Documentation

◆ Action

using BasicUI::Action = typedef std::function<void()>

Definition at line 24 of file BasicUI.h.

◆ ProgressReporter

using BasicUI::ProgressReporter = typedef std::function<void(double)>

Definition at line 25 of file BasicUI.h.

Enumeration Type Documentation

◆ Button

enum class BasicUI::Button
strong
Enumerator
Default 

Like Ok, except maybe minor difference of dialog position.

Ok 

One button.

YesNo 

Two buttons.

Definition at line 88 of file BasicUI.h.

88 {
89 Default,
90 Ok,
91 YesNo
92};
@ Ok
One button.
@ YesNo
Two buttons.

◆ ErrorDialogType

enum class BasicUI::ErrorDialogType
strong
Enumerator
ModelessError 
ModalError 
ModalErrorReport 

If error reporting is enabled, may give option to send; if not, then like ModalError

Definition at line 43 of file BasicUI.h.

◆ GenericProgressDialogStyle

Enumerator
ProgressCanAbort 
ProgressAppModal 
ProgressShowElapsedTime 
ProgressSmooth 

Definition at line 147 of file BasicUI.h.

147 : int {
148 ProgressCanAbort = (1 << 0),
149 ProgressAppModal = (1 << 1),
150 ProgressShowElapsedTime = (1 << 2),
151 ProgressSmooth = (1 << 3),
152};
@ ProgressCanAbort
Definition: BasicUI.h:148
@ ProgressShowElapsedTime
Definition: BasicUI.h:150
@ ProgressSmooth
Definition: BasicUI.h:151
@ ProgressAppModal
Definition: BasicUI.h:149

◆ Icon

enum class BasicUI::Icon
strong
Enumerator
None 
Warning 
Error 
Question 
Information 

Definition at line 80 of file BasicUI.h.

◆ MessageBoxResult

enum class BasicUI::MessageBoxResult : int
strong
Enumerator
None 

May be returned if no Services are installed.

Yes 
No 
Ok 
Cancel 

Definition at line 132 of file BasicUI.h.

◆ ProgressDialogOptions

Enumerator
ProgressShowStop 
ProgressShowCancel 
ProgressHideTime 
ProgressConfirmStopOrCancel 

Definition at line 140 of file BasicUI.h.

140 : unsigned {
141 ProgressShowStop = (1 << 0),
142 ProgressShowCancel = (1 << 1),
143 ProgressHideTime = (1 << 2),
145};
@ ProgressHideTime
Definition: BasicUI.h:143
@ ProgressShowCancel
Definition: BasicUI.h:142
@ ProgressConfirmStopOrCancel
Definition: BasicUI.h:144
@ ProgressShowStop
Definition: BasicUI.h:141

◆ ProgressResult

enum class BasicUI::ProgressResult : unsigned
strong
Enumerator
Cancelled 
Success 
Failed 
Stopped 

Definition at line 154 of file BasicUI.h.

155{
156 Cancelled = 0, //<! User says that whatever is happening is undesirable and shouldn't have happened at all
157 Success, //<! User says nothing, everything works fine, continue doing whatever we're doing
158 Failed, //<! Something has gone wrong, we should stop and cancel everything we did
159 Stopped //<! Nothing is wrong, but user says we should stop now and leave things as they are now
160};

Function Documentation

◆ CallAfter()

BASIC_UI_API void BasicUI::CallAfter ( Action  action)

Schedule an action to be done later, and in the main thread.

This function may be called in other threads than the main. If no Services are yet installed, the action is not lost, but may be dispatched by Yield(). The action may itself invoke CallAfter to enqueue other actions.

Definition at line 214 of file BasicUI.cpp.

215{
216 if (auto p = Get())
217 p->DoCallAfter(action);
218 else {
219 // No services yet -- but don't lose the action. Put it in a queue
220 auto guard = std::lock_guard{ sActionsMutex };
221 sActions.emplace_back(std::move(action));
222 }
223}
static std::vector< Action > sActions
Definition: BasicUI.cpp:212
Services * Get()
Fetch the global instance, or nullptr if none is yet installed.
Definition: BasicUI.cpp:202
static std::recursive_mutex sActionsMutex
Definition: BasicUI.cpp:211

References Get(), sActions, and sActionsMutex.

Referenced by AdornedRulerPanel::AdornedRulerPanel(), Clipboard::Assign(), PrefsListener::Broadcast(), AudioIO::CallAfterRecording(), audacity::cloud::audiocom::sync::DataUploader::UploadOperation::CleanUp(), Clipboard::Clear(), audacity::cloud::audiocom::UserService::ClearUserData(), LoginDialog::ContinueCreateAccount(), LoginDialog::ContinueSignIn(), anonymous_namespace{LoginDialog.cpp}::DefaultErrorHandler(), audacity::cloud::audiocom::OAuthService::DoAuthorise(), ProjectAudioManager::DoRecord(), ClipPitchAndSpeedButtonHandle::DoRelease(), audacity::cloud::audiocom::UserService::DownloadAvatar(), AudacityException::EnqueueAction(), UndoManager::EnqueueMessage(), audacity::cloud::audiocom::sync::MixdownUploader::DataExporter::ExportTread(), Journal::Events::FailedEventSerialization(), audacity::cloud::audiocom::sync::MixdownUploader::DataExporter::HandleExportDiskFullError(), audacity::cloud::audiocom::sync::MixdownUploader::DataExporter::HandleExportError(), audacity::cloud::audiocom::sync::MixdownUploader::DataExporter::HandleExportException(), AsyncPluginValidator::Impl::HandleInternalError(), Viewport::HandleResize(), AsyncPluginValidator::Impl::HandleResult(), audacity::cloud::audiocom::sync::MixdownUploader::DataExporter::HandleUnkonwnException(), ProjectFileManager::Import(), ProjectFileManager::ImportAndRunTempoDetection(), AudacityApp::InitPart2(), anonymous_namespace{ProjectStatus.cpp}::Dispatcher::NewFieldRegistered(), NotifyingSelectedRegion::Notify(), AudioSetupToolBar::OnAudioDeviceRescan(), TrackPanel::OnAudioIO(), AudacityApp::OnExceptionInMainLoop(), App::OnInit(), AudacityApp::OnInit(), AudacityApp::OnInit0(), AdornedRulerPanel::OnLeave(), TrackPanel::OnMouseEvent(), audacity::cloud::audiocom::sync::ProjectsListDialog::OnOpen(), IncompatiblePluginsDialog::OnPluginManagerClicked(), anonymous_namespace{SnappingToolBar.cpp}::SnapModePopup::OnPopup(), ErrorReportDialog::OnSend(), audacity::cloud::audiocom::OAuthService::ParseTokenResponse(), audacity::cloud::audiocom::anonymous_namespace{CloudSyncService.cpp}::PerformProjectGetRequest(), SelectionBar::Populate(), SpectralSelectionBar::Populate(), TimeToolBar::Populate(), PitchAndSpeedDialog::PopulateOrExchange(), CLExportProcessor::Process(), audacity::cloud::audiocom::sync::ProjectsListDialog::ProjectsListDialog(), audacity::cloud::audiocom::sync::ProjectCloudExtension::Publish(), TrackList::QueueEvent(), Viewport::Redraw(), AdornedRulerPanel::Refresh(), TrackPanel::Refresh(), audacity::cloud::audiocom::sync::ReopenProject(), audacity::cloud::audiocom::sync::MixdownUploader::ReportProgress(), audacity::cloud::audiocom::OAuthService::SafePublish(), ProjectFileIO::SaveProject(), ProjectFileIO::SetFileName(), TrackFocus::SetFocus(), ProjectFileIO::SetProjectTitle(), AudioIO::StopStream(), audacity::cloud::audiocom::CloudSyncService::UpdateDowloadProgress(), audacity::cloud::audiocom::UserService::UpdateUserData(), and audacity::cloud::audiocom::sync::UploadMixdown().

Here is the call graph for this function:

◆ DefaultCaption()

BASIC_UI_API TranslatableString BasicUI::DefaultCaption ( )

"Message", suitably translated

Definition at line 259 of file BasicUI.cpp.

260{
261 return XO("Message");
262}
XO("Cut/Copy/Paste")

References XO().

Referenced by MessageBoxException::DelayedHandlerAction().

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

◆ FindFocus()

std::unique_ptr< WindowPlacement > BasicUI::FindFocus ( )
inline

Find the window that is accepting keyboard input, if any.

Postcondition
result: result != nullptr (but may point to an empty WindowPlacement)

Definition at line 383 of file BasicUI.h.

384{
385 if (auto p = Get())
386 if (auto result = p->DoFindFocus())
387 return result;
388 return std::make_unique<WindowPlacement>();
389}

References Get().

Referenced by TagsEditorDialog::DoCancel(), wxWidgetsBasicUI::DoFindFocus(), anonymous_namespace{TrackPanel.cpp}::LabeledChannelGroup::Draw(), EffectPreview(), DeviceToolBar::EnableDisableButtons(), TrackPanelAx::EndChangeFocus(), EventMonitor::FilterEvent(), MenuCreator::FilterKeyEvent(), EventMonitor::HandleCapture(), ProgressDialog::Init(), ProjectWindow::MacShowUndockedToolbars(), TrackPanelAx::MessageForScreenReader(), anonymous_namespace{NavigationMenus.cpp}::NextOrPrevFrame(), NyqBench::OnAutoWrap(), DeviceToolBar::OnCaptureKey(), SelectionBar::OnCaptureKey(), TranscriptionToolBar::OnCaptureKey(), RealtimeEffectPanel::OnCharHook(), NyqBench::OnClear(), NyqBench::OnClearUpdate(), NyqBench::OnCopy(), NyqBench::OnCopyUpdate(), NyqBench::OnCut(), NyqBench::OnCutUpdate(), KeyView::OnDrawBackground(), KeyView::OnDrawItem(), RealtimeEffectListWindow::OnEffectListItemChange(), ToolBarResizer::OnEnter(), NyqBench::OnFind(), NyqBench::OnFont(), EffectUIHost::OnInitDialog(), NavigationActions::Handler::OnNextWindow(), NyqBench::OnOutputUpdate(), NumericTextCtrl::OnPaint(), NyqBench::OnPaste(), NyqBench::OnPasteUpdate(), NavigationActions::Handler::OnPrevWindow(), NyqBench::OnRedo(), NyqBench::OnRedoUpdate(), LabelDialog::OnRemove(), NyqBench::OnScriptUpdate(), NyqBench::OnSelectAll(), NyqBench::OnUndo(), NyqBench::OnUndoUpdate(), SelectionBar::OnUpdate(), SpectralSelectionBar::OnUpdate(), MenuCreator::RebuildMenuBar(), FrequencyPlotDialog::Recalc(), LabelTrackView::ShowContextMenu(), TrackPanelHasFocus(), HistoryDialog::UpdateLevels(), and wxTabTraversalWrapperCharHook().

Here is the call graph for this function:

◆ Get()

BASIC_UI_API Services * BasicUI::Get ( )

Fetch the global instance, or nullptr if none is yet installed.

Definition at line 202 of file BasicUI.cpp.

202{ return theInstance; }
static Services * theInstance
Definition: BasicUI.cpp:200

References theInstance.

Referenced by audacity::sentry::AddExceptionContext(), audacity::sentry::anonymous_namespace{SentryReport.cpp}::AddOSContext(), audacity::cloud::audiocom::sync::ProjectCloudUIExtension::AllowClosing(), CallAfter(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::CleanupOrphanBlocks(), WaveTrack::ConvertToSampleFormat(), audacity::network_manager::CurlHandleManager::CurlHandleManager(), StatusBarFieldItem::DispatchFieldChanged(), WaveChannelView::DoGetMultiView(), PlayableTrack::DoGetMute(), WaveChannelView::DoGetPlacements(), PlayableTrack::DoGetSolo(), DoProjectTempoChange(), PlayableTrack::DoSetMute(), WaveTrack::DoSetPan(), WaveTrack::DoSetRate(), PlayableTrack::DoSetSolo(), WaveTrack::DoSetVolume(), anonymous_namespace{WaveformView.cpp}::DrawWaveform(), WaveTrack::EmptyCopy(), FindFocus(), FindProjectFrame(), UndoManager::Get(), anonymous_namespace{ProjectWindows.cpp}::ProjectWindows::Get(), anonymous_namespace{TempoChange.cpp}::ProjectTempo::Get(), anonymous_namespace{PlayableTrack.cpp}::MuteAndSolo::Get(), anonymous_namespace{WaveChannelView.cpp}::PlacementArray::Get(), anonymous_namespace{WaveTrack.cpp}::WaveTrackData::Get(), GetAttachedWindows(), audacity::cloud::audiocom::sync::ProjectCloudExtension::GetCloudProjectPage(), Languages::GetLanguages(), audacity::sqlite::Row::GetOr(), WaveTrack::GetPan(), GetProjectFrame(), GetProjectPanel(), audacity::cloud::audiocom::CloudSyncService::GetProjectState(), GetProjectTempo(), WaveTrack::GetRate(), WaveTrack::GetSampleFormat(), audacity::cloud::audiocom::sync::ProjectCloudExtension::GetSavesCount(), PluginDataViewStateRenderer::GetSize(), UpdateManager::GetUpdates(), WaveTrack::GetVolume(), UpdateDataParser::HandleXMLTag(), anonymous_namespace{AudacityApp.cpp}::InitCrashreports(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::IsBlockLocked(), audacity::cloud::audiocom::sync::ProjectCloudExtension::IsBlockLocked(), audacity::cloud::audiocom::CloudSyncService::IsCloudProject(), anonymous_namespace{AudioComMenus.cpp}::IsCloudProjectFlag(), audacity::cloud::audiocom::sync::ProjectCloudExtension::IsFirstSyncDialogShown(), IsUiThread(), IsUsingRtlLayout(), WaveTrack::LinkConsistencyFix(), MakeGenericProgress(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::MarkProjectInDB(), audacity::cloud::audiocom::sync::ProjectCloudExtension::MarkProjectSynced(), anonymous_namespace{DynamicRangeProcessorHistoryPanel.cpp}::MayUsePenGradients(), EffectSettingsAccess::ModifySettings(), WaveTrack::MoveTo(), WaveTrack::NewestOrNewClip(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::OnBlockDownloaded(), anonymous_namespace{WaveTrackAffordanceControls.cpp}::OnChangePitchAndSpeed(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnClose(), audacity::cloud::audiocom::sync::ProjectCloudUIExtension::OnCloudStatusChanged(), anonymous_namespace{WaveTrackAffordanceControls.cpp}::OnEditClipName(), Grid::OnKeyDown(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnLoad(), audacity::cloud::audiocom::sync::RemoteProjectSnapshot::OnProjectBlobDownloaded(), anonymous_namespace{WaveTrackAffordanceControls.cpp}::OnRenderClipStretching(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnSave(), audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSnapshotCreated(), audacity::cloud::audiocom::sync::ProjectCloudExtension::OnSyncCompleted(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnUpdateSaved(), audacity::cloud::audiocom::sync::ProjectCloudExtension::OnUpdateSaved(), OpenInDefaultBrowser(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::PerformCloudSave(), anonymous_namespace{RealtimeEffectPanel.cpp}::EffectsMenuHelper::PickEffect(), ClipPitchAndSpeedButtonHandle::Preview(), PreferencesResetHandler::Register(), RemoveDependencies(), PluginDataViewStateRenderer::Render(), ResetPreferences(), WaveTrack::RightmostOrNewClip(), audacity::sentry::anonymous_namespace{SentryReport.cpp}::SerializeException(), audacity::cloud::audiocom::sync::ProjectCloudExtension::SetFirstSyncDialogShown(), SetFocus(), SetProjectFrame(), SetProjectPanel(), WaveTrack::ShiftBy(), ShowMultiDialog(), StatusBarFieldItem::StatusBarFieldItem(), ProjectStatusFieldsRegistry::Subscribe(), audacity::cloud::audiocom::CloudSyncService::SyncCloudSnapshot(), audacity::cloud::audiocom::CloudSyncService::SyncProject(), audacity::cloud::audiocom::sync::ProjectCloudExtension::UpdateIdFromDatabase(), WaveTrack::WaveTrack(), and Yield().

◆ Install()

BASIC_UI_API Services * BasicUI::Install ( Services pInstance)

Install an implementation; return the previously installed instance.

Definition at line 204 of file BasicUI.cpp.

205{
206 auto result = theInstance;
207 theInstance = pInstance;
208 return result;
209}

References theInstance.

Referenced by AudacityApp::OnInit0().

Here is the caller graph for this function:

◆ IsUiThread()

bool BasicUI::IsUiThread ( )
inline

Whether the current thread is the UI thread.

Definition at line 407 of file BasicUI.h.

408{
409 if (auto p = Get())
410 return p->IsUiThread();
411 return true;
412}

References Get().

Referenced by audacity::cloud::audiocom::sync::ProjectCloudExtension::Publish(), and audacity::cloud::audiocom::sync::MixdownUploader::ReportProgress().

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

◆ IsUsingRtlLayout()

bool BasicUI::IsUsingRtlLayout ( )
inline

Whether using a right-to-left language layout.

Definition at line 399 of file BasicUI.h.

400{
401 if (auto p = Get())
402 return p->IsUsingRtlLayout();
403 return false;
404}

References Get().

Referenced by CommandManager::DescribeCommandsAndShortcuts().

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

◆ MakeGenericProgress()

std::unique_ptr< GenericProgressDialog > BasicUI::MakeGenericProgress ( const WindowPlacement placement,
const TranslatableString title,
const TranslatableString message,
int  style = (ProgressAppModal | ProgressShowElapsedTime | ProgressSmooth) 
)
inline

Create and display a progress dialog (return nullptr if Services not installed)

This function makes a "generic" progress dialog, for the case when time to completion cannot be estimated, but some indication of progress is still given

Definition at line 320 of file BasicUI.h.

323{
324 if (auto p = Get())
325 return p->DoMakeGenericProgress(placement, title, message, style);
326 else
327 return nullptr;
328}
static const auto title

References Get(), anonymous_namespace{AudacityDontAskAgainMessageDialog.cpp}::style, and title.

Referenced by DBConnection::Close(), Importer::Import(), audacity::cloud::audiocom::sync::ProjectsListDialog::ProjectsTableData::Refresh(), ProjectFileIO::RenameOrWarn(), and ProjectFileIO::SaveProject().

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

◆ MakeProgress()

std::unique_ptr< ProgressDialog > BasicUI::MakeProgress ( const TranslatableString title,
const TranslatableString message,
unsigned  flags = (ProgressShowStop | ProgressShowCancel),
const TranslatableString remainingLabelText = {} 
)
inline

Create and display a progress dialog.

Parameters
flagsbitwise OR of values in ProgressDialogOptions
remainingLabelTextif not empty substitutes for "Remaining Time:"
Returns
nullptr if Services not installed

Definition at line 302 of file BasicUI.h.

306 {})
307{
308 if (auto p = Get())
309 return p->DoMakeProgress(title, message, flags, remainingLabelText);
310 else
311 return nullptr;
312}

Referenced by audacity::cloud::audiocom::sync::ProjectCloudUIExtension::AllowClosing(), ProjectFileIO::CopyTo(), EffectBase::DoEffect(), EffectPreview(), UpdateManager::GetUpdates(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::MakeProgress(), MixAndRender(), anonymous_namespace{EditMenus.cpp}::NotificationScope(), SqliteSampleBlockFactory::OnBeginPurge(), anonymous_namespace{ProjectFileManager.cpp}::ImportProgress::OnImportProgress(), anonymous_namespace{TrackMenus.cpp}::OnResample(), anonymous_namespace{ProjectFileManager.cpp}::RunTempoDetection(), anonymous_namespace{ExportProgressUI.cpp}::DialogExportProgressDelegate::UpdateUI(), audacity::cloud::audiocom::sync::UploadMixdown(), and UserException::WithCancellableProgress().

Here is the caller graph for this function:

◆ OpenInDefaultBrowser()

BASIC_UI_API bool BasicUI::OpenInDefaultBrowser ( const wxString &  url)

Open an URL in default browser.

This function may be called in other threads than the main.

Definition at line 246 of file BasicUI.cpp.

247{
248#if defined(HAS_XDG_OPEN_HELPER)
249 if (RunXDGOpen(url.ToStdString()))
250 return true;
251#endif
252
253 if(auto p = Get())
254 return p->DoOpenInDefaultBrowser(url);
255
256 return false;
257}

References Get().

Referenced by LoginDialog::ContinueAuthorize(), anonymous_namespace{PluginMenus.cpp}::EffectMenu(), audacity::cloud::audiocom::ShareAudioDialog::HandleUploadSucceeded(), RealtimeEffectPanel::MakeTrackEffectPane(), audacity::cloud::audiocom::sync::ProjectCloudUIExtension::OnCloudStatusChanged(), PluginRegistrationDialog::OnGetMoreEffects(), audacity::cloud::audiocom::UserPanel::OnLinkButtonPressed(), audacity::cloud::audiocom::sync::ProjectsListDialog::OnOpen(), audacity::cloud::audiocom::sync::ProjectsListDialog::OnOpenAudioCom(), anonymous_namespace{CloudProjectFileIOExtensions.cpp}::IOExtension::OnUpdateSaved(), OpenInDefaultBrowser(), anonymous_namespace{RealtimeEffectPanel.cpp}::EffectsMenuHelper::PickEffect(), and AudacityFileConfig::Warn().

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

◆ SetFocus()

void BasicUI::SetFocus ( const WindowPlacement focus)
inline

Set the window that accepts keyboard input.

Definition at line 392 of file BasicUI.h.

393{
394 if (auto p = Get())
395 p->DoSetFocus(focus);
396}

References Get().

Referenced by EffectPreview(), NumericTextCtrl::OnContext(), KeyView::OnLeftDown(), NumericTextCtrl::OnMouse(), TrackPanel::OnTrackFocusChange(), wxSliderWrapper::SetFocus(), ListNavigationEnabled< WindowBase >::SetFocus(), PitchAndSpeedDialog::SetFocus(), AdornedRulerPanel::SetFocusFromKbd(), AButton::SetFocusFromKbd(), ASlider::SetFocusFromKbd(), MeterPanel::SetFocusFromKbd(), and UpdateNoticeDialog::UpdateNoticeDialog().

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

◆ ShowErrorDialog()

void BasicUI::ShowErrorDialog ( const WindowPlacement placement,
const TranslatableString dlogTitle,
const TranslatableString message,
const ManualPageID helpPage,
const ErrorDialogOptions options = {} 
)
inline

Show an error dialog with a link to the manual for further help.

Parameters
placementhow to parent the dialog
dlogTitleText for title bar
messageThe main message text
helpPageIdentifies manual page (and maybe an anchor)

Definition at line 272 of file BasicUI.h.

277 {})
278{
279 if (auto p = Get())
280 p->DoShowErrorDialog(placement, dlogTitle, message, helpPage, options);
281}

Referenced by MessageBoxException::DelayedHandlerAction(), ProjectFileManager::DoImport(), ProjectAudioManager::DoRecord(), ClipPitchAndSpeedButtonHandle::DoRelease(), ProjectFileManager::DoSave(), EffectPreview(), TempDirectory::FATFilesystemDenied(), UpdateManager::GetUpdates(), audacity::cloud::audiocom::ShareAudioDialog::HandleExportFailure(), audacity::cloud::audiocom::ShareAudioDialog::HandleUploadFailed(), anonymous_namespace{TransportMenus.cpp}::OnPunchAndRoll(), ProjectAudioManager::PlayPlayRegion(), ProjectFileIO::ProjectFileIO(), audacity::cloud::audiocom::sync::ProjectsListDialog::ProjectsTableData::Refresh(), ProjectFileManager::SaveCopy(), ExportProgressUI::Show(), ShowDiskFullExportErrorDialog(), ProjectFileIO::ShowError(), ShowExportErrorDialog(), AudioIO::StartMonitoring(), CommandManager::TellUserWhyDisallowed(), and TempDirectory::TempDir().

Here is the caller graph for this function:

◆ ShowMessageBox()

MessageBoxResult BasicUI::ShowMessageBox ( const TranslatableString message,
MessageBoxOptions  options = {} 
)
inline

Show a modal message box with either Ok or Yes and No, and optionally Cancel.

Returns
indicates which button was pressed

Definition at line 287 of file BasicUI.h.

288 {})
289{
290 if (auto p = Get())
291 return p->DoMessageBox(message, std::move(options));
292 else
293 return MessageBoxResult::None;
294}

Referenced by AudioIO::AllocateBuffers(), AudioIO::AudioIO(), anonymous_namespace{Registry.cpp}::BadPath(), ExportMP3::CheckFileName(), CreateDirectory(), ThemeBase::CreateImageCache(), ThemeBase::CreateOneImageCache(), anonymous_namespace{LoginDialog.cpp}::DefaultErrorHandler(), MessageBoxException::DelayedHandlerAction(), AudacityApplicationLogic::DoEffect(), DoMessageBox(), PluginManager::DropFile(), ExportProgressUI::ExceptionWrappedCall(), Journal::Events::FailedEventSerialization(), EffectAndCommandPluginManager::GetAudacityCommand(), PlotSpectrumBase::GetAudio(), ContrastBase::GetDB(), gtk_filedialog_ok_callback(), audacity::cloud::audiocom::sync::MixdownUploader::DataExporter::HandleUnkonwnException(), VSTWrapper::HandleXMLTag(), LabelTrack::Import(), AutoDuckBase::Init(), EqualizationBase::Init(), ScienFilterBase::Init(), NyquistBase::Init(), ExportOptionsCLEditor::IsValidCommand(), EQCurveReader::LoadCurves(), VSTWrapper::LoadFXB(), VSTWrapper::LoadFXP(), MP3Exporter::LoadLibrary(), ThemeBase::LoadOneThemeComponents(), Effect::LoadSettingsFromString(), VSTWrapper::LoadXML(), anonymous_namespace{MIDIPlay.h}::MIDIPlay::MIDIPlay(), RealtimeEffectListWindow::OnAddEffectClicked(), WaveTrackMenuTable::OnMergeStereo(), SelectActions::Handler::OnZeroCrossing(), SFFileCloser::operator()(), NyquistBase::ParseProgram(), ClickRemovalBase::Process(), Generator::Process(), NoiseReductionBase::Process(), Repair::Process(), NyquistBase::Process(), NoiseReductionBase::Worker::Process(), TruncSilenceBase::ProcessIndependently(), DtmfBase::Instance::ProcessInitialize(), EchoBase::Instance::ProcessInitialize(), PaulstretchBase::ProcessOne(), ClickRemovalBase::ProcessOne(), FindClippingBase::ProcessOne(), NyquistBase::ProcessOne(), ThemeBase::ReadImageCache(), ProjectFileManager::ReadProjectFile(), VSTWrapper::SaveFXB(), VSTWrapper::SaveFXP(), EqualizationCurvesList::setCurve(), ImportUtils::ShowMessageBox(), AudioIO::StartStream(), MessageBoxTarget::Update(), SpectrogramSettings::Validate(), NoiseReductionBase::Settings::Validate(), and Sequence::WriteXML().

◆ ShowMultiDialog()

int BasicUI::ShowMultiDialog ( const TranslatableString message,
const TranslatableString title,
const TranslatableStrings buttons,
const ManualPageID helpPage,
const TranslatableString boxMsg,
bool  log 
)
inline

Display a dialog with radio buttons.

Returns
zero-based index of the chosen button, or -1 if Services not installed.
Parameters
messagemain message in the dialog
titledialog title
buttonslabels for individual radio buttons
boxMsglabel for the group of buttons
helpPageidentifies a manual page
logwhether to add a "Show Log for Details" push button

Definition at line 367 of file BasicUI.h.

372{
373 if (auto p = Get())
374 return p->DoMultiDialog(message, title, buttons, helpPage, boxMsg, log);
375 else
376 return -1;
377}

References Get(), and title.

Referenced by wxWidgetsBasicUI::DoMultiDialog(), ProjectFSCK(), and ModuleManager::TryLoadModules().

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

◆ SplitProgress()

template<typename ItType , typename FnType >
void BasicUI::SplitProgress ( ItType  first,
ItType  last,
FnType  action,
ProgressReporter  parent 
)

Helper for the update of a task's progress bar when this task is made of a range's subtasks.

For each item from first till last, forwards the item as argument to action, as well as a progress reporter that will contribute by a fraction to the parent progress reporter. This fraction is the inverse of the number of elements in the range.

Definition at line 339 of file BasicUI.h.

341{
342 auto count = 0;
343 const auto numIters = std::distance(first, last);
344 if (numIters == 0)
345 return;
346 const ProgressReporter child =
347 parent ? [&](double progress) { parent((count + progress) / numIters); } :
349
350 for (; first != last; ++first)
351 {
352 action(*first, child);
353 ++count;
354 }
355}
std::function< void(double)> ProgressReporter
Definition: Track.h:48
std::function< void(double)> ProgressReporter
Definition: BasicUI.h:25

Referenced by anonymous_namespace{LabelMenus.cpp}::EditByLabel(), EffectOutputTracks::EffectOutputTracks(), anonymous_namespace{EditMenus.cpp}::OnJoin(), and anonymous_namespace{EditMenus.cpp}::OnSilence().

Here is the caller graph for this function:

◆ Yield()

BASIC_UI_API void BasicUI::Yield ( )

Dispatch waiting events, including actions enqueued by CallAfter.

This function must be called by the main thread. Actions enqueued by CallAfter before Services were installed will be dispatched in the sequence they were enqueued, unless an exception thrown by one of them stops the dispatching.

Definition at line 225 of file BasicUI.cpp.

226{
227 do {
228 // Dispatch anything in the queue, added while there were no Services
229 {
230 auto guard = std::lock_guard{ sActionsMutex };
231 std::vector<Action> actions;
232 actions.swap(sActions);
233 for (auto &action : actions)
234 action();
235 }
236
237 // Dispatch according to Services, if present
238 if (auto p = Get())
239 p->DoYield();
240 }
241 // Re-test for more actions that might have been enqueued by actions just
242 // dispatched
243 while ( !sActions.empty() );
244}

References Get(), sActions, and sActionsMutex.

Referenced by audacity::cloud::audiocom::sync::ProjectCloudUIExtension::AllowClosing(), EVT_COMMAND_RANGE(), audacity::cloud::audiocom::sync::anonymous_namespace{CloudProjectOpenUtils.cpp}::GetResult(), Importer::Import(), Viewport::OnScroll(), CLExportProcessor::Process(), audacity::cloud::audiocom::sync::ProjectsListDialog::ProjectsTableData::Refresh(), audacity::cloud::audiocom::ShareAudioDialog::ResetProgress(), and audacity::cloud::audiocom::sync::UploadMixdown().

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

Variable Documentation

◆ sActions

std::vector<Action> BasicUI::sActions
static

Definition at line 212 of file BasicUI.cpp.

Referenced by CallAfter(), and Yield().

◆ sActionsMutex

std::recursive_mutex BasicUI::sActionsMutex
static

Definition at line 211 of file BasicUI.cpp.

Referenced by CallAfter(), and Yield().

◆ theInstance

Services* BasicUI::theInstance = nullptr
static

Definition at line 200 of file BasicUI.cpp.

Referenced by Get(), and Install().