mirror of
https://github.com/cookiengineer/audacity
synced 2025-04-30 15:49:41 +02:00
Redo zoom setting choices in Tracks preferences
This commit is contained in:
parent
aed6eb2215
commit
293f22db37
@ -6817,10 +6817,8 @@ void AudacityProject::OnZoomToggle(const CommandContext &WXUNUSED(context) )
|
||||
// const double origWidth = GetScreenEndTime() - origLeft;
|
||||
|
||||
// Choose the zoom that is most different to the current zoom.
|
||||
double Zoom1 = GetZoomOfPref(
|
||||
wxT("/GUI/ZoomPreset1"), WaveTrack::kZoomDefault );
|
||||
double Zoom2 = GetZoomOfPref(
|
||||
wxT("/GUI/ZoomPreset2"), WaveTrack::kZoom4To1 );
|
||||
double Zoom1 = GetZoomOfPreset( TracksPrefs::Zoom1Choice() );
|
||||
double Zoom2 = GetZoomOfPreset( TracksPrefs::Zoom2Choice() );
|
||||
double Z = mViewInfo.GetZoom();// Current Zoom.
|
||||
double ChosenZoom = abs(log(Zoom1 / Z)) > abs(log( Z / Zoom2)) ? Zoom1:Zoom2;
|
||||
|
||||
|
@ -6014,12 +6014,6 @@ double AudacityProject::GetZoomOfPreset( int preset ){
|
||||
return result;
|
||||
}
|
||||
|
||||
double AudacityProject::GetZoomOfPref( const wxString & PresetPrefName, int defaultPreset ){
|
||||
int preset=defaultPreset;
|
||||
gPrefs->Read( PresetPrefName, &preset, defaultPreset );
|
||||
return GetZoomOfPreset( preset );
|
||||
}
|
||||
|
||||
AudacityProject::PlaybackScroller::PlaybackScroller(AudacityProject *project)
|
||||
: mProject(project)
|
||||
{
|
||||
|
@ -600,7 +600,6 @@ public:
|
||||
double GetZoomOfToFit();
|
||||
double GetZoomOfSelection();
|
||||
double GetZoomOfPreset(int preset );
|
||||
double GetZoomOfPref( const wxString & PresetPrefName, int defaultPreset );
|
||||
|
||||
public:
|
||||
bool IsSoloSimple() const { return mSoloPref == wxT("Simple"); }
|
||||
|
@ -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();
|
||||
|
@ -39,15 +39,14 @@ class TracksPrefs final : public PrefsPanel
|
||||
|
||||
static WaveTrack::WaveTrackDisplay ViewModeChoice();
|
||||
static WaveTrack::SampleDisplay SampleViewChoice();
|
||||
static WaveTrack::ZoomPresets Zoom1Choice();
|
||||
static WaveTrack::ZoomPresets Zoom2Choice();
|
||||
|
||||
private:
|
||||
void Populate();
|
||||
void PopulateOrExchange(ShuttleGui & S) override;
|
||||
|
||||
static int iPreferencePinned;
|
||||
|
||||
std::vector<int> mZoomCodes;
|
||||
wxArrayString mZoomChoices;
|
||||
};
|
||||
|
||||
class TracksPrefsFactory final : public PrefsPanelFactory
|
||||
|
Loading…
x
Reference in New Issue
Block a user