1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-12-04 15:50:10 +01:00

bug 11 followup: Add dialogs and shortcuts for each combo of device toolbar

This commit is contained in:
mchinen
2011-01-29 18:46:06 +00:00
parent ed20efb357
commit 47ac55b29c
4 changed files with 116 additions and 1 deletions

View File

@@ -812,3 +812,59 @@ void DeviceToolBar::OnChoice(wxCommandEvent &event)
}
}
void DeviceToolBar::ShowInputDialog()
{
ShowComboDialog(mInput, wxString(_("Select Input Device")));
}
void DeviceToolBar::ShowOutputDialog()
{
ShowComboDialog(mOutput, wxString(_("Select Output Device")));
}
void DeviceToolBar::ShowHostDialog()
{
ShowComboDialog(mHost, wxString(_("Select Audio Host")));
}
void DeviceToolBar::ShowChannelsDialog()
{
ShowComboDialog(mInputChannels, wxString(_("Select Input Channels")));
}
void DeviceToolBar::ShowComboDialog(wxChoice *combo, wxString &title)
{
if (!combo || combo->GetCount() == 0) {
wxMessageBox(_("Device information is not available."));
return;
}
#if USE_PORTMIXER
wxArrayString inputSources = combo->GetStrings();
wxDialog dlg(NULL, wxID_ANY, title);
ShuttleGui S(&dlg, eIsCreating);
wxChoice *c;
S.StartVerticalLay(true);
{
S.StartHorizontalLay(wxCENTER, false);
{
c = S.AddChoice(combo->GetName(),
combo->GetStringSelection(),
&inputSources);
}
S.EndHorizontalLay();
S.AddStandardButtons();
}
S.EndVerticalLay();
dlg.SetSize(dlg.GetSizer()->GetMinSize());
dlg.Center();
if (dlg.ShowModal() == wxID_OK)
{
wxCommandEvent e(wxEVT_COMMAND_CHOICE_SELECTED, dlg.GetId());
combo->SetSelection(c->GetSelection());
// This will fire an event which will invoke OnChoice above.
combo->ProcessCommand(e);
}
#endif
}

View File

@@ -57,6 +57,12 @@ class DeviceToolBar:public ToolBar {
/// It should be small enough to work on tiny screens
int GetInitialWidth() {return 520;}
virtual int GetMinToolbarWidth() {return 200;}
void ShowInputDialog();
void ShowOutputDialog();
void ShowHostDialog();
void ShowChannelsDialog();
private:
int ChangeHost();
void FillHostDevices();
@@ -65,6 +71,8 @@ class DeviceToolBar:public ToolBar {
void RepositionCombos();
void RegenerateTooltips();
void ShowComboDialog(wxChoice *combo, wxString &title);
wxBitmap *mPlayBitmap;
wxBitmap *mRecordBitmap;