mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-27 17:48:38 +02:00
Settings UI Spectrogram views only. Retract the Waveforms page development.
This commit is contained in:
commit
42cd2ab3ee
@ -292,8 +292,9 @@ enum {
|
||||
OnFloatID, // <---
|
||||
|
||||
OnWaveformID,
|
||||
OnWaveformDBID,
|
||||
OnSpectrumID,
|
||||
OnViewSettingsID,
|
||||
OnSpectrogramSettingsID,
|
||||
|
||||
OnSplitStereoID,
|
||||
OnSplitStereoMonoID,
|
||||
@ -342,7 +343,7 @@ BEGIN_EVENT_TABLE(TrackPanel, wxWindow)
|
||||
EVT_MENU_RANGE(OnChannelLeftID, OnChannelMonoID,
|
||||
TrackPanel::OnChannelChange)
|
||||
EVT_MENU_RANGE(OnWaveformID, OnSpectrumID, TrackPanel::OnSetDisplay)
|
||||
EVT_MENU(OnViewSettingsID, TrackPanel::OnViewSettings)
|
||||
EVT_MENU(OnSpectrogramSettingsID, TrackPanel::OnSpectrogramSettings)
|
||||
EVT_MENU_RANGE(OnRate8ID, OnRate384ID, TrackPanel::OnRateChange)
|
||||
EVT_MENU_RANGE(On16BitID, OnFloatID, TrackPanel::OnFormatChange)
|
||||
EVT_MENU(OnRateOtherID, TrackPanel::OnRateOther)
|
||||
@ -751,9 +752,10 @@ void TrackPanel::BuildMenus(void)
|
||||
/* build the pop-down menu used on wave (sampled audio) tracks */
|
||||
mWaveTrackMenu = new wxMenu();
|
||||
BuildCommonDropMenuItems(mWaveTrackMenu); // does name, up/down etc
|
||||
mWaveTrackMenu->AppendRadioItem(OnWaveformID, _("&Waveform"));
|
||||
mWaveTrackMenu->AppendRadioItem(OnWaveformID, _("Wa&veform"));
|
||||
mWaveTrackMenu->AppendRadioItem(OnWaveformDBID, _("&Waveform (dB)"));
|
||||
mWaveTrackMenu->AppendRadioItem(OnSpectrumID, _("&Spectrogram"));
|
||||
mWaveTrackMenu->Append(OnViewSettingsID, _("&View Settings..."));
|
||||
mWaveTrackMenu->Append(OnSpectrogramSettingsID, _("S&pectrogram Settings..."));
|
||||
mWaveTrackMenu->AppendSeparator();
|
||||
|
||||
mChannelItemsInsertionPoint = mWaveTrackMenu->GetMenuItemCount();
|
||||
@ -8741,13 +8743,16 @@ void TrackPanel::OnTrackMenu(Track *t)
|
||||
}
|
||||
}
|
||||
|
||||
const int display = static_cast<WaveTrack *>(t)->GetDisplay();
|
||||
WaveTrack *const track = (WaveTrack *)t;
|
||||
const int display = track->GetDisplay();
|
||||
theMenu->Check(
|
||||
(display == WaveTrack::Waveform) ? OnWaveformID : OnSpectrumID,
|
||||
(display == WaveTrack::Waveform)
|
||||
? (track->GetWaveformSettings().isLinear() ? OnWaveformID : OnWaveformDBID)
|
||||
: OnSpectrumID,
|
||||
true
|
||||
);
|
||||
theMenu->Enable(OnSpectrogramSettingsID, display == WaveTrack::Spectrum);
|
||||
|
||||
WaveTrack * track = (WaveTrack *)t;
|
||||
SetMenuCheck(*mRateMenu, IdOfRate((int) track->GetRate()));
|
||||
SetMenuCheck(*mFormatMenu, IdOfFormat(track->GetSampleFormat()));
|
||||
|
||||
@ -9287,15 +9292,14 @@ private:
|
||||
const int mPage;
|
||||
};
|
||||
|
||||
void TrackPanel::OnViewSettings(wxCommandEvent &)
|
||||
void TrackPanel::OnSpectrogramSettings(wxCommandEvent &)
|
||||
{
|
||||
WaveTrack *const wt = static_cast<WaveTrack*>(mPopupMenuTarget);
|
||||
WaveformPrefsFactory waveformFactory(wt);
|
||||
// WaveformPrefsFactory waveformFactory(wt);
|
||||
SpectrumPrefsFactory spectrumFactory(wt);
|
||||
|
||||
// Put Waveform page first
|
||||
PrefsDialog::Factories factories;
|
||||
factories.push_back(&waveformFactory);
|
||||
// factories.push_back(&waveformFactory);
|
||||
factories.push_back(&spectrumFactory);
|
||||
const int page = (wt->GetDisplay() == WaveTrack::Spectrum)
|
||||
? 1 : 0;
|
||||
@ -9319,21 +9323,37 @@ void TrackPanel::OnSetDisplay(wxCommandEvent & event)
|
||||
wxASSERT(mPopupMenuTarget
|
||||
&& mPopupMenuTarget->GetKind() == Track::Wave);
|
||||
|
||||
bool linear = false;
|
||||
WaveTrack::WaveTrackDisplay id;
|
||||
switch (idInt) {
|
||||
default:
|
||||
case OnWaveformID:
|
||||
linear = true, id = WaveTrack::Waveform; break;
|
||||
case OnWaveformDBID:
|
||||
id = WaveTrack::Waveform; break;
|
||||
case OnSpectrumID:
|
||||
id = WaveTrack::Spectrum; break;
|
||||
}
|
||||
WaveTrack *wt = (WaveTrack *) mPopupMenuTarget;
|
||||
if (wt->GetDisplay() != id) {
|
||||
const bool wrongType = wt->GetDisplay() != id;
|
||||
const bool wrongScale =
|
||||
(id == WaveTrack::Waveform &&
|
||||
wt->GetWaveformSettings().isLinear() != linear);
|
||||
if (wrongType || wrongScale) {
|
||||
wt->SetDisplay(WaveTrack::WaveTrackDisplay(id));
|
||||
if (wrongScale)
|
||||
wt->GetIndependentWaveformSettings().scaleType = linear
|
||||
? WaveformSettings::stLinear
|
||||
: WaveformSettings::stLogarithmic;
|
||||
|
||||
WaveTrack *l = static_cast<WaveTrack *>(wt->GetLink());
|
||||
if (l)
|
||||
if (l) {
|
||||
l->SetDisplay(WaveTrack::WaveTrackDisplay(id));
|
||||
if (wrongScale)
|
||||
l->GetIndependentWaveformSettings().scaleType = linear
|
||||
? WaveformSettings::stLinear
|
||||
: WaveformSettings::stLogarithmic;
|
||||
}
|
||||
#ifdef EXPERIMENTAL_OUTPUT_DISPLAY
|
||||
if (wt->GetDisplay() == WaveTrack::WaveformDisplay) {
|
||||
wt->SetVirtualState(false);
|
||||
|
@ -484,7 +484,7 @@ protected:
|
||||
virtual void MoveTrack(Track* target, int eventId);
|
||||
virtual void OnChangeOctave (wxCommandEvent &event);
|
||||
virtual void OnChannelChange(wxCommandEvent &event);
|
||||
virtual void OnViewSettings(wxCommandEvent &event);
|
||||
virtual void OnSpectrogramSettings(wxCommandEvent &event);
|
||||
virtual void OnSetDisplay (wxCommandEvent &event);
|
||||
virtual void OnSetTimeTrackRange (wxCommandEvent &event);
|
||||
virtual void OnTimeTrackLin(wxCommandEvent &event);
|
||||
|
@ -86,7 +86,14 @@ WaveTrack::WaveTrack(DirManager *projDirManager, sampleFormat format, double rat
|
||||
rate = GetActiveProject()->GetRate();
|
||||
}
|
||||
|
||||
// Force creation always:
|
||||
WaveformSettings &settings = GetIndependentWaveformSettings();
|
||||
|
||||
mDisplay = FindDefaultViewMode();
|
||||
if (mDisplay == obsoleteWaveformDBDisplay) {
|
||||
mDisplay = Waveform;
|
||||
settings.scaleType = WaveformSettings::stLogarithmic;
|
||||
}
|
||||
|
||||
mLegacyProjectFileOffset = 0;
|
||||
|
||||
@ -113,7 +120,14 @@ WaveTrack::WaveTrack(WaveTrack &orig):
|
||||
, mpWaveformSettings(orig.mpWaveformSettings
|
||||
? new WaveformSettings(*orig.mpWaveformSettings) : 0)
|
||||
{
|
||||
// Force creation always:
|
||||
WaveformSettings &settings = GetIndependentWaveformSettings();
|
||||
|
||||
mDisplay = FindDefaultViewMode();
|
||||
if (mDisplay == obsoleteWaveformDBDisplay) {
|
||||
mDisplay = Waveform;
|
||||
settings.scaleType = WaveformSettings::stLinear;
|
||||
}
|
||||
mLastScaleType = -1;
|
||||
|
||||
mLegacyProjectFileOffset = 0;
|
||||
@ -236,12 +250,9 @@ WaveTrack::ConvertLegacyDisplayValue(int oldValue)
|
||||
switch (oldValue) {
|
||||
default:
|
||||
case Waveform:
|
||||
case WaveformDB:
|
||||
newValue = WaveTrack::Waveform; break;
|
||||
/*
|
||||
case WaveformDB:
|
||||
newValue = WaveTrack::WaveformDBDisplay; break;
|
||||
*/
|
||||
newValue = WaveTrack::obsoleteWaveformDBDisplay; break;
|
||||
case Spectrogram:
|
||||
case SpectrogramLogF:
|
||||
case Pitch:
|
||||
@ -263,6 +274,7 @@ WaveTrack::ValidateWaveTrackDisplay(WaveTrackDisplay display)
|
||||
switch (display) {
|
||||
// non-obsolete codes
|
||||
case Waveform:
|
||||
case obsoleteWaveformDBDisplay:
|
||||
case Spectrum:
|
||||
return display;
|
||||
|
||||
@ -273,9 +285,6 @@ WaveTrack::ValidateWaveTrackDisplay(WaveTrackDisplay display)
|
||||
case obsolete4: // was PitchDisplay
|
||||
return Spectrum;
|
||||
|
||||
case obsolete5: // was WaveformDBDisplay
|
||||
return Waveform;
|
||||
|
||||
// codes out of bounds (from future prefs files?)
|
||||
default:
|
||||
return MinDisplay;
|
||||
|
@ -407,7 +407,7 @@ class AUDACITY_DLL_API WaveTrack : public Track {
|
||||
Waveform = 0,
|
||||
MinDisplay = Waveform,
|
||||
|
||||
obsolete5, // was WaveformDBDisplay
|
||||
obsoleteWaveformDBDisplay,
|
||||
|
||||
Spectrum,
|
||||
|
||||
|
@ -64,7 +64,8 @@
|
||||
#include "ThemePrefs.h"
|
||||
#include "TracksPrefs.h"
|
||||
#include "WarningsPrefs.h"
|
||||
#include "WaveformPrefs.h"
|
||||
// #include "WaveformPrefs.h"
|
||||
#include "WaveformSettings.h"
|
||||
#include "ExtImportPrefs.h"
|
||||
|
||||
#ifdef EXPERIMENTAL_MIDI_OUT
|
||||
@ -132,7 +133,7 @@ PrefsDialog::Factories
|
||||
#if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || !defined(DISABLE_DYNAMIC_LOADING_LAME)
|
||||
static LibraryPrefsFactory libraryPrefsFactory;
|
||||
#endif
|
||||
static WaveformPrefsFactory waveformPrefsFactory;
|
||||
// static WaveformPrefsFactory waveformPrefsFactory;
|
||||
static SpectrumPrefsFactory spectrumPrefsFactory;
|
||||
static DirectoriesPrefsFactory directoriesPrefsFactory;
|
||||
static WarningsPrefsFactory warningsPrefsFactory;
|
||||
@ -157,10 +158,9 @@ PrefsDialog::Factories
|
||||
&qualityPrefsFactory,
|
||||
&guiPrefsFactory,
|
||||
|
||||
// Group two other pages
|
||||
PrefsNode(&tracksPrefsFactory, 2, true),
|
||||
&waveformPrefsFactory,
|
||||
&spectrumPrefsFactory,
|
||||
&tracksPrefsFactory,
|
||||
// &waveformPrefsFactory,
|
||||
// &spectrumPrefsFactory,
|
||||
|
||||
// Group one other page
|
||||
PrefsNode(&importExportPrefsFactory, 1, true),
|
||||
@ -170,6 +170,7 @@ PrefsDialog::Factories
|
||||
#if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || !defined(DISABLE_DYNAMIC_LOADING_LAME)
|
||||
&libraryPrefsFactory,
|
||||
#endif
|
||||
&spectrumPrefsFactory,
|
||||
&directoriesPrefsFactory,
|
||||
&warningsPrefsFactory,
|
||||
&effectsPrefsFactory,
|
||||
@ -196,15 +197,22 @@ PrefsDialog::PrefsDialog
|
||||
wxDefaultSize,
|
||||
wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
, mFactories(factories)
|
||||
, mCategories(NULL)
|
||||
, mUniquePage(NULL)
|
||||
, mTitlePrefix(titlePrefix)
|
||||
{
|
||||
wxASSERT(factories.size() > 0);
|
||||
const bool uniquePage = (factories.size() == 1);
|
||||
|
||||
ShuttleGui S(this, eIsCreating);
|
||||
|
||||
S.StartVerticalLay(true);
|
||||
{
|
||||
wxASSERT(factories.size() > 0);
|
||||
if (!uniquePage) {
|
||||
mCategories = new wxTreebookExt(this, wxID_ANY, mTitlePrefix);
|
||||
S.StartHorizontalLay(wxALIGN_LEFT | wxEXPAND, true);
|
||||
{
|
||||
mCategories = new wxTreebookExt(this, wxID_ANY, mTitlePrefix);
|
||||
S.Prop(1);
|
||||
S.AddWindow(mCategories, wxEXPAND);
|
||||
|
||||
@ -237,6 +245,14 @@ PrefsDialog::PrefsDialog
|
||||
}
|
||||
S.EndHorizontalLay();
|
||||
}
|
||||
else {
|
||||
// Unique page, don't show the factory
|
||||
const PrefsNode &node = factories[0];
|
||||
PrefsPanelFactory &factory = *node.pFactory;
|
||||
mUniquePage = factory.Create(this);
|
||||
S.AddWindow(mUniquePage, wxEXPAND);
|
||||
}
|
||||
}
|
||||
S.EndVerticalLay();
|
||||
|
||||
S.AddStandardButtons(eOkButton | eCancelButton);
|
||||
@ -251,6 +267,7 @@ PrefsDialog::PrefsDialog
|
||||
wxSize sz = GetSize();
|
||||
|
||||
// Collapse nodes only after layout so the tree is wide enough
|
||||
if (mCategories)
|
||||
{
|
||||
int iPage = 0;
|
||||
for (Factories::const_iterator it = factories.begin(), end = factories.end();
|
||||
@ -290,6 +307,7 @@ PrefsDialog::~PrefsDialog()
|
||||
|
||||
int PrefsDialog::ShowModal()
|
||||
{
|
||||
if (mCategories) {
|
||||
/* long is signed, size_t is unsigned. On some platforms they are different
|
||||
* lengths as well. So we must check that the stored category is both > 0
|
||||
* and within the possible range of categories, making the first check on the
|
||||
@ -299,6 +317,12 @@ int PrefsDialog::ShowModal()
|
||||
if (selected < 0 || size_t(selected) >= mCategories->GetPageCount())
|
||||
selected = 0; // clamp to available range of tabs
|
||||
mCategories->SetSelection(selected);
|
||||
}
|
||||
else {
|
||||
wxString Temp = mTitlePrefix + mUniquePage->GetLabel();
|
||||
SetTitle(Temp);
|
||||
SetName(Temp);
|
||||
}
|
||||
|
||||
return wxDialog::ShowModal();
|
||||
}
|
||||
@ -307,9 +331,13 @@ void PrefsDialog::OnCancel(wxCommandEvent & WXUNUSED(event))
|
||||
{
|
||||
RecordExpansionState();
|
||||
|
||||
if (mCategories) {
|
||||
for (size_t i = 0; i < mCategories->GetPageCount(); i++) {
|
||||
((PrefsPanel *) mCategories->GetPage(i))->Cancel();
|
||||
((PrefsPanel *)mCategories->GetPage(i))->Cancel();
|
||||
}
|
||||
}
|
||||
else
|
||||
mUniquePage->Cancel();
|
||||
|
||||
EndModal(false);
|
||||
}
|
||||
@ -327,8 +355,9 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
||||
RecordExpansionState();
|
||||
|
||||
// Validate all pages first
|
||||
if (mCategories) {
|
||||
for (size_t i = 0; i < mCategories->GetPageCount(); i++) {
|
||||
PrefsPanel *panel = (PrefsPanel *) mCategories->GetPage(i);
|
||||
PrefsPanel *panel = (PrefsPanel *)mCategories->GetPage(i);
|
||||
|
||||
// The dialog doesn't end until all the input is valid
|
||||
if (!panel->Validate()) {
|
||||
@ -336,13 +365,22 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!mUniquePage->Validate())
|
||||
return;
|
||||
}
|
||||
|
||||
if (mCategories) {
|
||||
// Now apply the changes
|
||||
for (size_t i = 0; i < mCategories->GetPageCount(); i++) {
|
||||
PrefsPanel *panel = (PrefsPanel *) mCategories->GetPage(i);
|
||||
PrefsPanel *panel = (PrefsPanel *)mCategories->GetPage(i);
|
||||
|
||||
panel->Apply();
|
||||
}
|
||||
}
|
||||
else
|
||||
mUniquePage->Apply();
|
||||
|
||||
SavePreferredPage();
|
||||
|
||||
@ -386,6 +424,7 @@ void PrefsDialog::OnOK(wxCommandEvent & WXUNUSED(event))
|
||||
|
||||
void PrefsDialog::SelectPageByName(wxString pageName)
|
||||
{
|
||||
if (mCategories) {
|
||||
size_t n = mCategories->GetPageCount();
|
||||
|
||||
for (size_t i = 0; i < n; i++) {
|
||||
@ -394,11 +433,15 @@ void PrefsDialog::SelectPageByName(wxString pageName)
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int PrefsDialog::GetSelectedPage() const
|
||||
{
|
||||
if (mCategories)
|
||||
return mCategories->GetSelection();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
GlobalPrefsDialog::GlobalPrefsDialog(wxWindow * parent, Factories &factories)
|
||||
@ -425,10 +468,13 @@ void GlobalPrefsDialog::SavePreferredPage()
|
||||
void PrefsDialog::RecordExpansionState()
|
||||
{
|
||||
// Remember expansion state of the tree control
|
||||
if (mCategories)
|
||||
{
|
||||
int iPage = 0;
|
||||
for (Factories::iterator it = mFactories.begin(), end = mFactories.end();
|
||||
it != end; ++it, ++iPage)
|
||||
it->expanded = mCategories->IsNodeExpanded(iPage);
|
||||
}
|
||||
else
|
||||
mFactories[0].expanded = true;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <wx/treebook.h>
|
||||
#include <wx/window.h>
|
||||
|
||||
class PrefsPanel;
|
||||
class PrefsPanelFactory;
|
||||
|
||||
#ifdef __GNUC__
|
||||
@ -75,6 +76,7 @@ class PrefsDialog:public wxDialog
|
||||
private:
|
||||
void RecordExpansionState();
|
||||
wxTreebook *mCategories;
|
||||
PrefsPanel *mUniquePage;
|
||||
Factories &mFactories;
|
||||
const wxString mTitlePrefix;
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
SpectrumPrefs::SpectrumPrefs(wxWindow * parent, WaveTrack *wt)
|
||||
: PrefsPanel(parent, _("Spectrograms"))
|
||||
: PrefsPanel(parent, wt ? _("Spectrogram Settings") : _("Spectrograms"))
|
||||
, mWt(wt)
|
||||
, mPopulating(false)
|
||||
{
|
||||
@ -403,7 +403,6 @@ bool SpectrumPrefs::Apply()
|
||||
mTempSettings.ConvertToEnumeratedWindowSizes();
|
||||
|
||||
if (mWt && isOpenPage) {
|
||||
// Future: open page will determine the track view type
|
||||
mWt->SetDisplay(WaveTrack::Spectrum);
|
||||
if (partner)
|
||||
partner->SetDisplay(WaveTrack::Spectrum);
|
||||
|
@ -62,6 +62,9 @@ void TracksPrefs::Populate()
|
||||
mViewChoices.Add(_("Waveform"));
|
||||
mViewCodes.Add(int(WaveTrack::Waveform));
|
||||
|
||||
mViewChoices.Add(_("Waveform (dB)"));
|
||||
mViewCodes.Add(int(WaveTrack::obsoleteWaveformDBDisplay));
|
||||
|
||||
mViewChoices.Add(_("Spectrum"));
|
||||
mViewCodes.Add(WaveTrack::Spectrum);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user