1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-26 00:03:52 +02:00

Redo zoom setting choices in Tracks preferences

This commit is contained in:
Paul Licameli
2018-03-20 14:02:46 -04:00
parent aed6eb2215
commit 293f22db37
5 changed files with 74 additions and 54 deletions

View File

@@ -146,6 +146,74 @@ WaveTrack::SampleDisplay TracksPrefs::SampleViewChoice()
return (WaveTrack::SampleDisplay) sampleDisplaySetting.ReadInt();
}
//////////
static const IdentInterfaceSymbol choicesZoom[] = {
{ wxT("FitToWidth"), XO("Fit to Width") },
{ wxT("ZoomToSelection"), XO("Zoom to Selection") },
{ wxT("ZoomDefault"), XO("Zoom Default") },
{ XO("Minutes") },
{ XO("Seconds") },
{ wxT("FifthsOfSeconds"), XO("5ths of Seconds") },
{ wxT("TenthsOfSeconds"), XO("10ths of Seconds") },
{ wxT("TwentiethsOfSeconds"), XO("20ths of Seconds") },
{ wxT("FiftiethsOfSeconds"), XO("50ths of Seconds") },
{ wxT("HundredthsOfSeconds"), XO("100ths of Seconds") },
{ wxT("FiveHundredthsOfSeconds"), XO("500ths of Seconds") },
{ XO("MilliSeconds") },
{ XO("Samples") },
{ wxT("FourPixelsPerSample"), XO("4 Pixels per Sample") },
{ wxT("MaxZoom"), XO("Max Zoom") },
};
static const size_t nChoicesZoom = WXSIZEOF( choicesZoom );
static const int intChoicesZoom[] = {
WaveTrack::kZoomToFit,
WaveTrack::kZoomToSelection,
WaveTrack::kZoomDefault,
WaveTrack::kZoomMinutes,
WaveTrack::kZoomSeconds,
WaveTrack::kZoom5ths,
WaveTrack::kZoom10ths,
WaveTrack::kZoom20ths,
WaveTrack::kZoom50ths,
WaveTrack::kZoom100ths,
WaveTrack::kZoom500ths,
WaveTrack::kZoomMilliSeconds,
WaveTrack::kZoomSamples,
WaveTrack::kZoom4To1,
WaveTrack::kMaxZoom,
};
static_assert( nChoicesZoom == WXSIZEOF(intChoicesZoom), "size mismatch" );
static const size_t defaultChoiceZoom1 = 2; // kZoomDefault
static EncodedEnumSetting zoom1Setting{
wxT("/GUI/ZoomPreset1Choice"),
choicesZoom, nChoicesZoom, defaultChoiceZoom1,
intChoicesZoom,
wxT("/GUI/ZoomPreset1")
};
static const size_t defaultChoiceZoom2 = 13; // kZoom4To1
static EncodedEnumSetting zoom2Setting{
wxT("/GUI/ZoomPreset2Choice"),
choicesZoom, nChoicesZoom, defaultChoiceZoom2,
intChoicesZoom,
wxT("/GUI/ZoomPreset2")
};
WaveTrack::ZoomPresets TracksPrefs::Zoom1Choice()
{
return (WaveTrack::ZoomPresets) zoom1Setting.ReadInt();
}
WaveTrack::ZoomPresets TracksPrefs::Zoom2Choice()
{
return (WaveTrack::ZoomPresets) zoom2Setting.ReadInt();
}
//////////
TracksPrefs::TracksPrefs(wxWindow * parent, wxWindowID winid)
/* i18n-hint: "Tracks" include audio recordings but also other collections of
@@ -168,38 +236,6 @@ void TracksPrefs::Populate()
// How samples are displayed when zoomed in:
mZoomChoices.Add( _("Fit to Width") );
mZoomCodes.push_back( WaveTrack::kZoomToFit );
mZoomChoices.Add( _("Zoom to Selection") );
mZoomCodes.push_back( WaveTrack::kZoomToSelection );
mZoomChoices.Add( _("Zoom Default") );
mZoomCodes.push_back( WaveTrack::kZoomDefault );
mZoomChoices.Add( _("Minutes") );
mZoomCodes.push_back( WaveTrack::kZoomMinutes );
mZoomChoices.Add( _("Seconds") );
mZoomCodes.push_back( WaveTrack::kZoomSeconds );
mZoomChoices.Add( _("5ths of Seconds") );
mZoomCodes.push_back( WaveTrack::kZoom5ths );
mZoomChoices.Add( _("10ths of Seconds") );
mZoomCodes.push_back( WaveTrack::kZoom10ths );
mZoomChoices.Add( _("20ths of Seconds") );
mZoomCodes.push_back( WaveTrack::kZoom20ths );
mZoomChoices.Add( _("50ths of Seconds") );
mZoomCodes.push_back( WaveTrack::kZoom50ths );
mZoomChoices.Add( _("100ths of Seconds") );
mZoomCodes.push_back( WaveTrack::kZoom100ths );
mZoomChoices.Add( _("500ths of Seconds") );
mZoomCodes.push_back( WaveTrack::kZoom500ths );
mZoomChoices.Add( _("MilliSeconds") );
mZoomCodes.push_back( WaveTrack::kZoomMilliSeconds );
mZoomChoices.Add( _("Samples") );
mZoomCodes.push_back( WaveTrack::kZoomSamples );
mZoomChoices.Add( _("4 Pixels per Sample") );
mZoomCodes.push_back( WaveTrack::kZoom4To1 );
mZoomChoices.Add( _("Max Zoom") );
mZoomCodes.push_back( WaveTrack::kMaxZoom );
//------------------------- Main section --------------------
// Now construct the GUI itself.
@@ -254,16 +290,10 @@ void TracksPrefs::PopulateOrExchange(ShuttleGui & S)
S.StartMultiColumn(4);
{
S.TieChoice(_("Preset 1:"),
wxT("/GUI/ZoomPreset1"),
WaveTrack::kZoomDefault,
mZoomChoices,
mZoomCodes);
zoom1Setting );
S.TieChoice(_("Preset 2:"),
wxT("/GUI/ZoomPreset2"),
WaveTrack::kZoom4To1,
mZoomChoices,
mZoomCodes);
zoom2Setting );
}
}
S.EndStatic();