mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-25 08:58:06 +02:00
bug 11 followup: Add dialogs and shortcuts for each combo of device toolbar
This commit is contained in:
parent
ed20efb357
commit
47ac55b29c
@ -92,6 +92,7 @@ simplifies construction of menu items.
|
||||
#include "toolbars/ControlToolBar.h"
|
||||
#include "toolbars/ToolsToolBar.h"
|
||||
#include "toolbars/EditToolBar.h"
|
||||
#include "toolbars/DeviceToolBar.h"
|
||||
#include "toolbars/MixerToolBar.h"
|
||||
#include "toolbars/TranscriptionToolBar.h"
|
||||
|
||||
@ -1128,6 +1129,19 @@ void AudacityProject::CreateMenusAndCommands()
|
||||
|
||||
c->AddCommand(wxT("FullScreenOnOff"), _("Full screen on/off"), FN(OnFullScreen), wxT("F11"));
|
||||
|
||||
c->AddCommand(wxT("InputDevice"), _("Change input device"), FN(OnInputDevice), wxT("Shift+I"),
|
||||
AudioIONotBusyFlag,
|
||||
AudioIONotBusyFlag);
|
||||
c->AddCommand(wxT("OutputDevice"), _("Change output device"), FN(OnOutputDevice), wxT("Shift+O"),
|
||||
AudioIONotBusyFlag,
|
||||
AudioIONotBusyFlag);
|
||||
c->AddCommand(wxT("AudioHost"), _("Change audio host"), FN(OnAudioHost), wxT("Shift+H"),
|
||||
AudioIONotBusyFlag,
|
||||
AudioIONotBusyFlag);
|
||||
c->AddCommand(wxT("InputChannels"), _("Change input channels"), FN(OnInputChannels), wxT("Shift+N"),
|
||||
AudioIONotBusyFlag,
|
||||
AudioIONotBusyFlag);
|
||||
|
||||
c->AddCommand(wxT("OutputGain"), _("Adjust output gain"), FN(OnOutputGain));
|
||||
c->AddCommand(wxT("OutputGainInc"), _("Increase output gain"), FN(OnOutputGainInc));
|
||||
c->AddCommand(wxT("OutputGainDec"), _("Decrease output gain"), FN(OnOutputGainDec));
|
||||
@ -2396,6 +2410,38 @@ void AudacityProject::OnTrackClose()
|
||||
mTrackPanel->OnTrackClose();
|
||||
}
|
||||
|
||||
void AudacityProject::OnInputDevice()
|
||||
{
|
||||
DeviceToolBar *tb = GetDeviceToolBar();
|
||||
if (tb) {
|
||||
tb->ShowInputDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void AudacityProject::OnOutputDevice()
|
||||
{
|
||||
DeviceToolBar *tb = GetDeviceToolBar();
|
||||
if (tb) {
|
||||
tb->ShowOutputDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void AudacityProject::OnAudioHost()
|
||||
{
|
||||
DeviceToolBar *tb = GetDeviceToolBar();
|
||||
if (tb) {
|
||||
tb->ShowHostDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void AudacityProject::OnInputChannels()
|
||||
{
|
||||
DeviceToolBar *tb = GetDeviceToolBar();
|
||||
if (tb) {
|
||||
tb->ShowChannelsDialog();
|
||||
}
|
||||
}
|
||||
|
||||
void AudacityProject::OnOutputGain()
|
||||
{
|
||||
MixerToolBar *tb = GetMixerToolBar();
|
||||
|
@ -106,11 +106,16 @@ void OnTrackMute();
|
||||
void OnTrackSolo();
|
||||
void OnTrackClose();
|
||||
|
||||
// Device control
|
||||
void OnInputDevice();
|
||||
void OnOutputDevice();
|
||||
void OnAudioHost();
|
||||
void OnInputChannels();
|
||||
|
||||
// Mixer control
|
||||
|
||||
void OnOutputGain();
|
||||
void OnInputGain();
|
||||
void OnInputSource();
|
||||
void OnOutputGainInc();
|
||||
void OnOutputGainDec();
|
||||
void OnInputGainInc();
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user