mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 08:09:32 +02:00
Redo sample display choice in Tracks preferences
This commit is contained in:
parent
83a01e255f
commit
aed6eb2215
@ -176,6 +176,7 @@ audio tracks.
|
||||
#include "Prefs.h"
|
||||
#include "prefs/GUISettings.h"
|
||||
#include "prefs/SpectrogramSettings.h"
|
||||
#include "prefs/TracksPrefs.h"
|
||||
#include "prefs/WaveformSettings.h"
|
||||
#include "Spectrum.h"
|
||||
#include "ViewInfo.h"
|
||||
@ -3311,7 +3312,7 @@ void TrackArtist::UpdatePrefs()
|
||||
{
|
||||
mdBrange = gPrefs->Read(ENV_DB_KEY, mdBrange);
|
||||
mShowClipping = gPrefs->Read(wxT("/GUI/ShowClipping"), mShowClipping);
|
||||
gPrefs->Read(wxT("/GUI/SampleView"), &mSampleDisplay, 1);
|
||||
mSampleDisplay = TracksPrefs::SampleViewChoice();
|
||||
SetColours(0);
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ class AUDACITY_DLL_API TrackArtist {
|
||||
// Preference values
|
||||
float mdBrange; // "/GUI/EnvdBRange"
|
||||
long mShowClipping; // "/GUI/ShowClipping"
|
||||
int mSampleDisplay; // "/GUI/SampleView"
|
||||
int mSampleDisplay;
|
||||
bool mbShowTrackNameInWaveform; // "/GUI/ShowTrackNameInWaveform"
|
||||
|
||||
int mMarginLeft;
|
||||
|
@ -118,6 +118,34 @@ WaveTrack::WaveTrackDisplay TracksPrefs::ViewModeChoice()
|
||||
return (WaveTrack::WaveTrackDisplay) viewModeSetting.ReadInt();
|
||||
}
|
||||
|
||||
//////////
|
||||
static const IdentInterfaceSymbol choicesSampleDisplay[] = {
|
||||
{ wxT("ConnectDots"), XO("Connect dots") },
|
||||
{ wxT("StemPlot"), XO("Stem plot") }
|
||||
};
|
||||
static const size_t nChoicesSampleDisplay = WXSIZEOF( choicesSampleDisplay );
|
||||
static const int intChoicesSampleDisplay[] = {
|
||||
(int) WaveTrack::LinearInterpolate,
|
||||
(int) WaveTrack::StemPlot
|
||||
};
|
||||
static_assert(
|
||||
nChoicesSampleDisplay == WXSIZEOF(intChoicesSampleDisplay), "size mismatch" );
|
||||
|
||||
static const size_t defaultChoiceSampleDisplay = 1;
|
||||
|
||||
static EncodedEnumSetting sampleDisplaySetting{
|
||||
wxT("/GUI/SampleViewChoice"),
|
||||
choicesSampleDisplay, nChoicesSampleDisplay, defaultChoiceSampleDisplay,
|
||||
|
||||
intChoicesSampleDisplay,
|
||||
wxT("/GUI/SampleView")
|
||||
};
|
||||
|
||||
WaveTrack::SampleDisplay TracksPrefs::SampleViewChoice()
|
||||
{
|
||||
return (WaveTrack::SampleDisplay) sampleDisplaySetting.ReadInt();
|
||||
}
|
||||
|
||||
//////////
|
||||
TracksPrefs::TracksPrefs(wxWindow * parent, wxWindowID winid)
|
||||
/* i18n-hint: "Tracks" include audio recordings but also other collections of
|
||||
@ -140,12 +168,6 @@ void TracksPrefs::Populate()
|
||||
|
||||
// How samples are displayed when zoomed in:
|
||||
|
||||
mSampleDisplayChoices.Add(_("Connect dots"));
|
||||
mSampleDisplayCodes.push_back((int) WaveTrack::LinearInterpolate);
|
||||
|
||||
mSampleDisplayChoices.Add(_("Stem plot"));
|
||||
mSampleDisplayCodes.push_back((int) WaveTrack::StemPlot);
|
||||
|
||||
mZoomChoices.Add( _("Fit to Width") );
|
||||
mZoomCodes.push_back( WaveTrack::kZoomToFit );
|
||||
mZoomChoices.Add( _("Zoom to Selection") );
|
||||
@ -216,10 +238,7 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
|
||||
viewModeSetting );
|
||||
|
||||
S.TieChoice(_("Display &samples:"),
|
||||
wxT("/GUI/SampleView"),
|
||||
1,
|
||||
mSampleDisplayChoices,
|
||||
mSampleDisplayCodes);
|
||||
sampleDisplaySetting );
|
||||
|
||||
S.TieTextBox(_("Default audio track &name:"),
|
||||
wxT("/GUI/TrackNames/DefaultTrackName"),
|
||||
|
@ -38,6 +38,7 @@ class TracksPrefs final : public PrefsPanel
|
||||
static wxString GetDefaultAudioTrackNamePreference();
|
||||
|
||||
static WaveTrack::WaveTrackDisplay ViewModeChoice();
|
||||
static WaveTrack::SampleDisplay SampleViewChoice();
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
@ -45,8 +46,6 @@ class TracksPrefs final : public PrefsPanel
|
||||
|
||||
static int iPreferencePinned;
|
||||
|
||||
std::vector<int> mSampleDisplayCodes;
|
||||
wxArrayString mSampleDisplayChoices;
|
||||
std::vector<int> mZoomCodes;
|
||||
wxArrayString mZoomChoices;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user