Peter 22Nov11: I tansfrerred the FR referenced above to the Wiki Pending Feature Requests - retaining a link there to this page.waxcylinder wrote:Oh, and while we're suggesting enhancements to the TCP I'd like to add the ability to turn the sliders "on" and "off"[...] - default setting to be "off".
So, I pulled just this code out and applied it to today's SVN HEAD (r11277) and hereafter follows the result...Edgar wrote: I did this at least a year ago on my personal version of Audacity
First, we add two checkboxes to Preferences, add this code after line 92 of GUIPrefs.cpp:
Code: Select all
S.TieCheckBox(_("Disable Gain Slider by default"),
wxT("/GUI/DisableGainSlider"),
false);
S.TieCheckBox(_("Disable Pan Slider by default"),
wxT("/GUI/DisablePanSlider"),
false);
[GUI]
ShowSplashScreen=0
[...]
DisableGainSlider=1
DisablePanSlider=0
[GUI/ToolBars]
If these lines do not exist in the config file the sliders will default to ON contrary to waxcylinder's desire (that which would result in a regression IMHO).
The rest of the code is in TrackPanel.cpp & TrackPanel.h, in TrackPanel.h after line 426 we add two function definitions:
Code: Select all
void OnToggleGain(wxCommandEvent &event);
void OnTogglePan(wxCommandEvent &event);
Code: Select all
OnToggleGainID,
OnTogglePanID,
Code: Select all
EVT_MENU(OnToggleGainID, TrackPanel::OnToggleGain)
EVT_MENU(OnTogglePanID, TrackPanel::OnTogglePan)
Code: Select all
mWaveTrackMenu->Append(OnToggleGainID, _("Toggle Gain Slider State"));
mWaveTrackMenu->Append(OnTogglePanID, _("Toggle Pan Slider State"));
Code: Select all
LWSlider * TrackInfo::GainSlider(int trackIndex)
{
LWSlider * returnSlider = mGains[trackIndex - mSliderOffset];
bool disable;
gPrefs->Read(wxT("/GUI/DisableGainSlider"), &disable, false);
returnSlider->SetEnabled(!disable);
return returnSlider;
}
LWSlider * TrackInfo::PanSlider(int trackIndex)
{
LWSlider * returnSlider = mPans[trackIndex - mSliderOffset];
bool disable;
gPrefs->Read(wxT("/GUI/DisablePanSlider"), &disable, false);
returnSlider->SetEnabled(!disable);
return returnSlider;
}
Code: Select all
//the following two functions should toggle the active state of the Pan/Gain sliders in responce to
//the menu items but they do not work as-is
void TrackPanel::OnToggleGain(wxCommandEvent &event)
{
wxMessageBox(wxT("debug OnToggleGain()"));
Track * t = GetFocusedTrack();
if (!t || (t->GetKind() != Track::Wave)) {
return;
}
LWSlider * slider = mTrackInfo.GainSlider(t->GetIndex());
if (slider->GetEnabled()) slider->SetEnabled(false);
else slider->SetEnabled(true);
slider->Refresh();
}
void TrackPanel::OnTogglePan(wxCommandEvent &event)
{
wxMessageBox(wxT("debug OnTogglePan()"));
Track * t = GetFocusedTrack();
if (!t || (t->GetKind() != Track::Wave)) {
return;
}
LWSlider * slider = mTrackInfo.PanSlider(t->GetIndex());
if (slider->GetEnabled()) slider->SetEnabled(false);
else slider->SetEnabled(true);
slider->Refresh();
}
Here is the result of turning one slider off in prefs: After looking at these graphics I see I should reverse the order of the checkboxes to reflect the order of the sliders in the panel. I did so in the above example code but did not bother to change the picture. Now everything is "gain on top, pan on bottom".