mirror of
https://github.com/cookiengineer/audacity
synced 2025-10-21 06:01:13 +02:00
Pass array and count separately to read/write/define enum
This commit is contained in:
@@ -48,14 +48,13 @@ static const wxString kCoordTypeStrings[nCoordTypes] =
|
||||
|
||||
|
||||
bool DragCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString coords( nCoordTypes, kCoordTypeStrings );
|
||||
S.OptionalN( bHasId ).Define( mId, wxT("Id"), 11000.0, -100000.0, 1000000.0);
|
||||
S.OptionalY( bHasWinName ).Define( mWinName, wxT("Window"), "Timeline");
|
||||
S.OptionalY( bHasFromX ).Define( mFromX, wxT("FromX"), 200.0, 0.0, 1000000.0);
|
||||
S.OptionalY( bHasFromY ).Define( mFromY, wxT("FromY"), 10.0, 0.0, 1000000.0);
|
||||
S.OptionalN( bHasToX ).Define( mToX, wxT("ToX"), 400.0, 0.0, 1000000.0);
|
||||
S.OptionalN( bHasToY ).Define( mToY, wxT("ToY"), 10.0, 0.0, 1000000.0);
|
||||
S.OptionalN( bHasRelativeTo ).DefineEnum( mRelativeTo, wxT("RelativeTo"), kPanel, coords );
|
||||
S.OptionalN( bHasRelativeTo ).DefineEnum( mRelativeTo, wxT("RelativeTo"), kPanel, kCoordTypeStrings, nCoordTypes );
|
||||
return true;
|
||||
};
|
||||
|
||||
|
@@ -85,10 +85,8 @@ static const wxString kFormats[nFormats] =
|
||||
|
||||
|
||||
bool GetInfoCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString types( nTypes, kTypes );
|
||||
wxArrayString formats( nFormats, kFormats );
|
||||
S.DefineEnum( mInfoType, wxT("Type"), 0, types );
|
||||
S.DefineEnum( mFormat, wxT("Format"), 0, formats );
|
||||
S.DefineEnum( mInfoType, wxT("Type"), 0, kTypes, nTypes );
|
||||
S.DefineEnum( mFormat, wxT("Format"), 0, kFormats, nFormats );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -40,8 +40,7 @@ GetTrackInfoCommand::GetTrackInfoCommand()
|
||||
}
|
||||
|
||||
bool GetTrackInfoCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString types( nTypes, kTypes );
|
||||
S.DefineEnum( mInfoType, wxT("Type"), 0, types );
|
||||
S.DefineEnum( mInfoType, wxT("Type"), 0, kTypes, nTypes );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -92,11 +92,9 @@ static const wxString kBackgroundStrings[ ScreenshotCommand::nBackgrounds ] =
|
||||
|
||||
|
||||
bool ScreenshotCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString whats(nCaptureWhats, kCaptureWhatStrings);
|
||||
wxArrayString backs(nBackgrounds, kBackgroundStrings);
|
||||
S.Define( mPath, wxT("Path"), wxT(""));
|
||||
S.DefineEnum( mWhat, wxT("CaptureWhat"), kwindow, whats );
|
||||
S.OptionalN(bHasBackground).DefineEnum( mBack, wxT("Background"), kNone, backs );
|
||||
S.DefineEnum( mWhat, wxT("CaptureWhat"), kwindow,kCaptureWhatStrings, nCaptureWhats );
|
||||
S.OptionalN(bHasBackground).DefineEnum( mBack, wxT("Background"), kNone, kBackgroundStrings, nBackgrounds );
|
||||
S.OptionalN(bHasBringToTop).Define( mbBringToTop, wxT("ToTop"), true );
|
||||
return true;
|
||||
};
|
||||
|
@@ -55,12 +55,11 @@ static const wxString kRelativeTo[nRelativeTos] =
|
||||
};
|
||||
|
||||
bool SelectTimeCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString relativeSpec( nRelativeTos, kRelativeTo );
|
||||
// Allow selection down to -ve 100seconds.
|
||||
// Typically used to expand/contract selections by a small amount.
|
||||
S.OptionalY( bHasT0 ).Define( mT0, wxT("Start"), 0.0, -100.0, (double)FLT_MAX);
|
||||
S.OptionalY( bHasT1 ).Define( mT1, wxT("End"), 0.0, -100.0, (double)FLT_MAX);
|
||||
S.OptionalN( bHasRelativeSpec ).DefineEnum( mRelativeTo, wxT("RelativeTo"), 0, relativeSpec );
|
||||
S.OptionalN( bHasRelativeSpec ).DefineEnum( mRelativeTo, wxT("RelativeTo"), 0, kRelativeTo, nRelativeTos );
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -177,10 +176,9 @@ static const wxString kModes[nModes] =
|
||||
};
|
||||
|
||||
bool SelectTracksCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString modes( nModes, kModes );
|
||||
S.OptionalN( bHasFirstTrack).Define( mFirstTrack, wxT("Track"), 0.0, 0.0, 100.0);
|
||||
S.OptionalN( bHasNumTracks ).Define( mNumTracks, wxT("TrackCount"), 1.0, 0.0, 100.0);
|
||||
S.OptionalY( bHasMode ).DefineEnum( mMode, wxT("Mode"), 0, modes );
|
||||
S.OptionalY( bHasMode ).DefineEnum( mMode, wxT("Mode"), 0, kModes, nModes );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -48,9 +48,8 @@ static const wxString kColourStrings[nColours] =
|
||||
|
||||
|
||||
bool SetClipCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString colours( nColours, kColourStrings );
|
||||
S.OptionalY( bHasContainsTime ).Define( mContainsTime, wxT("At"), 0.0, 0.0, 100000.0 );
|
||||
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours );
|
||||
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, kColourStrings, nColours );
|
||||
// Allowing a negative start time is not a mistake.
|
||||
// It will be used in demonstrating time before zero.
|
||||
S.OptionalN( bHasT0 ).Define( mT0, wxT("Start"), 0.0, -5.0, 1000000.0);
|
||||
|
@@ -287,17 +287,12 @@ static const wxString kZoomTypeStrings[nZoomTypes] =
|
||||
};
|
||||
|
||||
bool SetTrackVisualsCommand::DefineParams( ShuttleParams & S ){
|
||||
wxArrayString colours( nColours, kColourStrings );
|
||||
wxArrayString displays( nDisplayTypes, kDisplayTypeStrings );
|
||||
wxArrayString scales( nScaleTypes, kScaleTypeStrings );
|
||||
wxArrayString vzooms( nZoomTypes, kZoomTypeStrings );
|
||||
|
||||
SetTrackBase::DefineParams( S );
|
||||
S.OptionalN( bHasHeight ).Define( mHeight, wxT("Height"), 120, 44, 700 );
|
||||
S.OptionalN( bHasDisplayType ).DefineEnum( mDisplayType, wxT("Display"), kWaveform, displays );
|
||||
S.OptionalN( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, scales );
|
||||
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, colours );
|
||||
S.OptionalN( bHasVZoom ).DefineEnum( mVZoom, wxT("VZoom"), kReset, vzooms );
|
||||
S.OptionalN( bHasDisplayType ).DefineEnum( mDisplayType, wxT("Display"), kWaveform, kDisplayTypeStrings, nDisplayTypes );
|
||||
S.OptionalN( bHasScaleType ).DefineEnum( mScaleType, wxT("Scale"), kLinear, kScaleTypeStrings, nScaleTypes );
|
||||
S.OptionalN( bHasColour ).DefineEnum( mColour, wxT("Color"), kColour0, kColourStrings, nColours );
|
||||
S.OptionalN( bHasVZoom ).DefineEnum( mVZoom, wxT("VZoom"), kReset, kZoomTypeStrings, nZoomTypes );
|
||||
|
||||
S.OptionalN( bHasUseSpecPrefs ).Define( bUseSpecPrefs, wxT("SpecPrefs"), false );
|
||||
S.OptionalN( bHasSpectralSelect ).Define( bSpectralSelect, wxT("SpectralSel"),true );
|
||||
|
Reference in New Issue
Block a user