1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 07:13:49 +01:00

Waveform dB is not a track type. Logarithmic is a Wavetrack scale type...

... Also removed one line from the track control drop-down, and changed
accelerators to more mnemonic choices.

Also the open page of View Settings... determines track view type after OK
This commit is contained in:
Paul Licameli
2015-06-21 20:03:15 -04:00
parent 5b72b1f23b
commit 5abbd463b2
12 changed files with 221 additions and 161 deletions

View File

@@ -60,10 +60,7 @@ void TracksPrefs::Populate()
// we don't display them by increasing integer values.
mViewChoices.Add(_("Waveform"));
mViewCodes.Add(int(WaveTrack::WaveformDisplay));
mViewChoices.Add(_("Waveform (dB)"));
mViewCodes.Add(int(WaveTrack::WaveformDBDisplay));
mViewCodes.Add(int(WaveTrack::Waveform));
mViewChoices.Add(_("Spectrum"));
mViewCodes.Add(WaveTrack::Spectrum);

View File

@@ -47,11 +47,13 @@ WaveformPrefs::~WaveformPrefs()
enum {
ID_DEFAULTS = 10001,
ID_APPLY,
ID_SCALE,
};
void WaveformPrefs::Populate()
{
// Create control objects
mScaleChoices = WaveformSettings::GetScaleNames();
//------------------------- Main section --------------------
// Now construct the GUI itself.
@@ -77,6 +79,9 @@ void WaveformPrefs::PopulateOrExchange(ShuttleGui & S)
{
S.StartTwoColumn();
{
S.Id(ID_SCALE).TieChoice(_("S&cale") + wxString(wxT(":")),
*(int*)&mTempSettings.scaleType,
&mScaleChoices);
}
S.EndTwoColumn();
}
@@ -151,12 +156,9 @@ bool WaveformPrefs::Apply()
}
if (mWt && isOpenPage) {
// Future: open page will determine view type
/*
mWt->SetDisplay(WaveTrack::Waveform);
if (partner)
partner->SetDisplay(WaveTrack::Waveform);
*/
}
return true;
@@ -194,6 +196,9 @@ void WaveformPrefs::OnApply(wxCommandEvent &)
}
BEGIN_EVENT_TABLE(WaveformPrefs, PrefsPanel)
EVT_CHOICE(ID_SCALE, WaveformPrefs::OnControl)
EVT_CHECKBOX(ID_DEFAULTS, WaveformPrefs::OnDefaults)
EVT_BUTTON(ID_APPLY, WaveformPrefs::OnApply)
END_EVENT_TABLE()

View File

@@ -41,6 +41,8 @@ private:
wxCheckBox *mDefaultsCheckbox;
wxArrayString mScaleChoices;
WaveformSettings mTempSettings;
bool mPopulating;

View File

@@ -16,6 +16,11 @@ Paul Licameli
#include "../Audacity.h"
#include "WaveformSettings.h"
#include <algorithm>
#include <wx/intl.h>
#include "../Prefs.h"
WaveformSettings::Globals::Globals()
{
LoadPrefs();
@@ -42,12 +47,14 @@ WaveformSettings::WaveformSettings()
}
WaveformSettings::WaveformSettings(const WaveformSettings &other)
: scaleType(other.scaleType)
{
}
WaveformSettings &WaveformSettings::operator= (const WaveformSettings &other)
{
if (this != &other) {
scaleType = other.scaleType;
}
return *this;
}
@@ -62,11 +69,17 @@ bool WaveformSettings::Validate(bool quiet)
{
quiet;
scaleType = ScaleType(
std::max(0, std::min(int(stNumScaleTypes) - 1, int(scaleType)))
);
return true;
}
void WaveformSettings::LoadPrefs()
{
scaleType = ScaleType(gPrefs->Read(wxT("/Waveform/ScaleType"), 0L));
// Enforce legal values
Validate(true);
@@ -75,12 +88,42 @@ void WaveformSettings::LoadPrefs()
void WaveformSettings::SavePrefs()
{
gPrefs->Write(wxT("/Waveform/ScaleType"), long(scaleType));
}
void WaveformSettings::Update()
{
}
namespace
{
wxArrayString &scaleNamesArray()
{
static wxArrayString theArray;
return theArray;
}
}
//static
void WaveformSettings::InvalidateNames()
{
scaleNamesArray().Clear();
}
//static
const wxArrayString &WaveformSettings::GetScaleNames()
{
wxArrayString &theArray = scaleNamesArray();
if (theArray.IsEmpty()) {
// Keep in correspondence with enum WaveTrack::WaveTrackDisplay:
theArray.Add(_("Linear"));
theArray.Add(_("Logarithmic"));
}
return theArray;
}
WaveformSettings::~WaveformSettings()
{
}

View File

@@ -11,6 +11,8 @@ Paul Licameli
#ifndef __AUDACITY_WAVEFORM_SETTINGS__
#define __AUDACITY_WAVEFORM_SETTINGS__
class wxArrayString;
class WaveformSettings
{
public:
@@ -42,5 +44,20 @@ public:
void LoadPrefs();
void SavePrefs();
void Update();
enum ScaleType {
stLinear,
stLogarithmic,
stNumScaleTypes,
};
static void InvalidateNames(); // in case of language change
static const wxArrayString &GetScaleNames();
ScaleType scaleType;
// Convenience
bool isLinear() const { return stLinear == scaleType; }
};
#endif