mirror of
https://github.com/cookiengineer/audacity
synced 2026-02-16 07:47:58 +01:00
All things with an UpdatePrefs() message listen for an event...
... Still to do, improve the handling of updates of only subsets of the prefs
This commit is contained in:
@@ -64,6 +64,12 @@ BEGIN_EVENT_TABLE(DeviceToolBar, ToolBar)
|
||||
EVT_COMMAND(wxID_ANY, EVT_CAPTURE_KEY, DeviceToolBar::OnCaptureKey)
|
||||
END_EVENT_TABLE()
|
||||
|
||||
static int DeviceToolbarPrefsID()
|
||||
{
|
||||
static int value = wxNewId();
|
||||
return value;
|
||||
}
|
||||
|
||||
//Standard contructor
|
||||
DeviceToolBar::DeviceToolBar()
|
||||
: ToolBar(DeviceBarID, _("Device"), wxT("Device"), true)
|
||||
@@ -313,6 +319,13 @@ void DeviceToolBar::UpdatePrefs()
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void DeviceToolBar::UpdateSelectedPrefs( int id )
|
||||
{
|
||||
if (id == DeviceToolbarPrefsID())
|
||||
UpdatePrefs();
|
||||
ToolBar::UpdateSelectedPrefs( id );
|
||||
}
|
||||
|
||||
|
||||
void DeviceToolBar::EnableDisableButtons()
|
||||
{
|
||||
@@ -773,10 +786,8 @@ void DeviceToolBar::OnChoice(wxCommandEvent &event)
|
||||
gAudioIO->HandleDeviceChange();
|
||||
}
|
||||
|
||||
// Update all projects' DeviceToolBar.
|
||||
for (size_t i = 0; i < gAudacityProjects.size(); i++) {
|
||||
gAudacityProjects[i]->GetDeviceToolBar()->UpdatePrefs();
|
||||
}
|
||||
wxTheApp->AddPendingEvent(wxCommandEvent{
|
||||
EVT_PREFS_UPDATE, DeviceToolbarPrefsID() });
|
||||
}
|
||||
|
||||
void DeviceToolBar::ShowInputDialog()
|
||||
|
||||
Reference in New Issue
Block a user