Audacity 3.2.0
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
NyquistEffect Class Referencefinal

#include <Nyquist.h>

Inheritance diagram for NyquistEffect:
[legend]
Collaboration diagram for NyquistEffect:
[legend]

Public Member Functions

 NyquistBase (const wxString &fName)
 
- Public Member Functions inherited from NyquistBase
 NyquistBase (const wxString &fName)
 
virtual ~NyquistBase ()
 
PluginPath GetPath () const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
ManualPageID ManualPage () const override
 Name of a page in the Audacity alpha manual, default is empty. More...
 
FilePath HelpPage () const override
 Fully qualified local help file name, default is empty. More...
 
EffectType GetType () const override
 Type determines how it behaves. More...
 
EffectType GetClassification () const override
 Determines which menu it appears in; default same as GetType(). More...
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
bool EnablesDebug () const override
 Whether the effect dialog should have a Debug button; default, always false. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
bool DoLoadSettings (const CommandParameters &parms, EffectSettings &settings)
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
int SetLispVarsFromParameters (const CommandParameters &parms, bool bTestOnly)
 
bool Init () override
 
bool Process (EffectInstance &instance, EffectSettings &settings) override
 
void RedirectOutput ()
 
void SetCommand (const wxString &cmd)
 
void Continue ()
 
void Break ()
 
void Stop ()
 
bool IsOk ()
 
- Public Member Functions inherited from EffectWithSettings< NyquistSettings, StatefulEffect >
EffectSettings MakeSettings () const override
 
bool CopySettingsContents (const EffectSettings &src, EffectSettings &dst) const override
 
- Public Member Functions inherited from StatefulEffect
 ~StatefulEffect () override
 
std::shared_ptr< EffectInstanceMakeInstance () const override
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from StatefulEffectBase
virtual bool Init ()
 
virtual bool Process (EffectInstance &instance, EffectSettings &settings)=0
 
virtual bool RealtimeInitialize (EffectSettings &settings, double sampleRate)
 
virtual bool RealtimeAddProcessor (EffectSettings &settings, EffectOutputs *pOutputs, unsigned numChannels, float sampleRate)
 
virtual bool RealtimeSuspend ()
 
virtual bool RealtimeResume ()
 
virtual bool RealtimeProcessStart (MessagePackage &package)
 settings are possibly changed, since last call, by an asynchronous dialog More...
 
virtual size_t RealtimeProcess (size_t group, EffectSettings &settings, const float *const *inBuf, float *const *outBuf, size_t numSamples)
 
virtual bool RealtimeProcessEnd (EffectSettings &settings) noexcept
 settings can be updated to let a dialog change appearance at idle More...
 
virtual bool RealtimeFinalize (EffectSettings &settings) noexcept
 
virtual size_t SetBlockSize (size_t maxBlockSize)
 
virtual size_t GetBlockSize () const
 
virtual unsigned GetAudioInCount () const
 How many input buffers to allocate at once. More...
 
virtual unsigned GetAudioOutCount () const
 How many output buffers to allocate at once. More...
 
virtual sampleCount GetLatency () const
 
virtual bool NeedsDither () const
 
virtual bool ProcessInitialize (EffectSettings &settings, double sampleRate, ChannelNames chanMap=nullptr)
 
virtual bool ProcessFinalize () noexcept
 
- Public Member Functions inherited from Effect
 Effect ()
 
virtual ~Effect ()
 
PluginPath GetPath () const override
 
bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings) override
 
bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const override
 
ComponentInterfaceSymbol GetSymbol () const override
 
VendorSymbol GetVendor () const override
 
wxString GetVersion () const override
 
TranslatableString GetDescription () const override
 
EffectFamilySymbol GetFamily () const override
 Report identifier and user-visible name of the effect protocol. More...
 
bool IsInteractive () const override
 Whether the effect needs a dialog for entry of settings. More...
 
bool IsDefault () const override
 Whether the effect sorts "above the line" in the menus. More...
 
RealtimeSince RealtimeSupport () const override
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsAutomation () const override
 Whether the effect has any automatable controls. More...
 
bool SaveSettings (const EffectSettings &settings, CommandParameters &parms) const override
 Store settings as keys and values. More...
 
bool LoadSettings (const CommandParameters &parms, EffectSettings &settings) const override
 Restore settings from keys and values. More...
 
OptionalMessage LoadUserPreset (const RegistryPath &name, EffectSettings &settings) const override
 
bool SaveUserPreset (const RegistryPath &name, const EffectSettings &settings) const override
 Save settings in the configuration file as a user-named preset. More...
 
RegistryPaths GetFactoryPresets () const override
 Report names of factory presets. More...
 
OptionalMessage LoadFactoryPreset (int id, EffectSettings &settings) const override
 
OptionalMessage LoadFactoryDefaults (EffectSettings &settings) const override
 
virtual const EffectParameterMethodsParameters () const
 
bool CanExportPresets () const override
 Whether the effect supports export of presets to files, and importing too. More...
 
bool HasOptions () const override
 
const EffectSettingsManagerGetDefinition () const override
 
virtual NumericFormatID GetSelectionFormat ()
 
bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const override
 
OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const override
 
bool IsBatchProcessing () const override
 
void SetBatchProcessing () override
 
void UnsetBatchProcessing () override
 
unsigned TestUIFlags (unsigned mask)
 
bool Delegate (Effect &delegate, EffectSettings &settings, InstanceFinder finder={})
 Re-invoke DoEffect on another Effect object that implements the work. More...
 
- Public Member Functions inherited from EffectBase
 EffectBase ()
 
 ~EffectBase () override
 
bool IsLinearEffect () const
 
bool PreviewsFullSelection () const
 
void SetTracks (TrackList *pTracks)
 
double GetDefaultDuration ()
 
virtual std::any BeginPreview (const EffectSettings &settings)
 Called when Preview() starts, to allow temporary effect state changes. More...
 
bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess) override
 
virtual double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const =0
 
void CountWaveTracks ()
 
- Public Member Functions inherited from EffectPlugin
EffectPluginoperator= (EffectPlugin &)=delete
 
virtual ~EffectPlugin ()
 
virtual bool HasOptions () const =0
 
virtual bool CanExportPresets () const =0
 Whether the effect supports export of presets to files, and importing too. More...
 
virtual const EffectSettingsManagerGetDefinition () const =0
 
virtual bool SaveSettingsAsString (const EffectSettings &settings, wxString &parms) const =0
 
virtual OptionalMessage LoadSettingsFromString (const wxString &parms, EffectSettings &settings) const =0
 
virtual bool IsBatchProcessing () const =0
 
virtual void SetBatchProcessing ()=0
 
virtual void UnsetBatchProcessing ()=0
 
virtual bool DoEffect (EffectSettings &settings, const InstanceFinder &finder, double projectRate, TrackList *list, WaveTrackFactory *factory, NotifyingSelectedRegion &selectedRegion, unsigned flags, const EffectSettingsAccessPtr &pAccess=nullptr)=0
 
- Public Member Functions inherited from EffectInstanceFactory
virtual ~EffectInstanceFactory ()
 
virtual std::shared_ptr< EffectInstanceMakeInstance () const =0
 Make an object maintaining short-term state of an Effect. More...
 
- Public Member Functions inherited from EffectSettingsManager
virtual ~EffectSettingsManager ()
 
virtual bool VisitSettings (SettingsVisitor &visitor, EffectSettings &settings)
 
virtual bool VisitSettings (ConstSettingsVisitor &visitor, const EffectSettings &settings) const
 
virtual std::unique_ptr< EffectOutputsMakeOutputs () const
 Produce an object to hold values to send to effect output meters. More...
 
- Public Member Functions inherited from EffectDefinitionInterface
virtual ~EffectDefinitionInterface ()
 
virtual EffectType GetType () const =0
 Type determines how it behaves. More...
 
virtual EffectType GetClassification () const
 Determines which menu it appears in; default same as GetType(). More...
 
virtual EffectFamilySymbol GetFamily () const =0
 Report identifier and user-visible name of the effect protocol. More...
 
virtual bool IsInteractive () const =0
 Whether the effect needs a dialog for entry of settings. More...
 
virtual bool IsDefault () const =0
 Whether the effect sorts "above the line" in the menus. More...
 
virtual RealtimeSince RealtimeSupport () const =0
 Since which version of Audacity has the effect supported realtime? More...
 
bool SupportsRealtime () const
 
virtual bool SupportsAutomation () const =0
 Whether the effect has any automatable controls. More...
 
virtual bool EnablesDebug () const
 Whether the effect dialog should have a Debug button; default, always false. More...
 
virtual ManualPageID ManualPage () const
 Name of a page in the Audacity alpha manual, default is empty. More...
 
virtual FilePath HelpPage () const
 Fully qualified local help file name, default is empty. More...
 
virtual bool IsHiddenFromMenus () const
 Default is false. More...
 
- Public Member Functions inherited from ComponentInterface
virtual ~ComponentInterface ()
 
virtual PluginPath GetPath () const =0
 
virtual ComponentInterfaceSymbol GetSymbol () const =0
 
virtual VendorSymbol GetVendor () const =0
 
virtual wxString GetVersion () const =0
 
virtual TranslatableString GetDescription () const =0
 
TranslatableString GetName () const
 
- Public Member Functions inherited from StatefulEffectUIServices
 ~StatefulEffectUIServices () override
 
std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const override
 Allows PopulateOrExchange to return null. More...
 
virtual std::unique_ptr< EffectEditorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs)
 Add controls to effect panel; always succeeds. More...
 
virtual bool TransferDataToWindow (const EffectSettings &settings)
 
virtual bool TransferDataFromWindow (EffectSettings &settings)
 
- Public Member Functions inherited from BasicEffectUIServices
int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal) const override
 
void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const override
 
OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const override
 
void ShowOptions (const EffectPlugin &plugin) const override
 
bool ValidateUI (const EffectPlugin &context, EffectSettings &) const override
 
bool CloseUI () const override
 
- Public Member Functions inherited from EffectUIServices
virtual ~EffectUIServices ()
 
virtual int ShowHostInterface (EffectBase &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false)
 
virtual int ShowClientInterface (const EffectPlugin &plugin, wxWindow &parent, wxDialog &dialog, EffectEditor *pEditor, bool forceModal=false) const =0
 
virtual std::unique_ptr< EffectEditorPopulateUI (const EffectPlugin &plugin, ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) const =0
 Adds controls to a panel that is given as the parent window of S More...
 
virtual void ExportPresets (const EffectPlugin &plugin, const EffectSettings &settings) const =0
 
virtual OptionalMessage ImportPresets (const EffectPlugin &plugin, EffectSettings &settings) const =0
 
virtual void ShowOptions (const EffectPlugin &plugin) const =0
 
virtual bool ValidateUI (const EffectPlugin &context, EffectSettings &settings) const =0
 
virtual bool CloseUI () const =0
 

Protected Member Functions

void OnLoad (wxCommandEvent &evt)
 
void OnSave (wxCommandEvent &evt)
 
void OnDebug (wxCommandEvent &evt)
 
void OnText (wxCommandEvent &evt)
 
void OnSlider (wxCommandEvent &evt)
 
void OnChoice (wxCommandEvent &evt)
 
void OnTime (wxCommandEvent &evt)
 
void OnFileButton (wxCommandEvent &evt)
 
- Protected Member Functions inherited from NyquistBase
bool ParseCommand (const wxString &cmd)
 
bool validatePath (wxString path)
 
wxString ToTimeFormat (double t)
 
- Protected Member Functions inherited from Effect
bool CheckWhetherSkipEffect (const EffectSettings &settings) const override
 Default implementation returns false. More...
 
double CalcPreviewInputLength (const EffectSettings &settings, double previewLength) const override
 Default implementation returns previewLength More...
 
bool TotalProgress (double frac, const TranslatableString &={}) const
 
bool TrackProgress (int whichTrack, double frac, const TranslatableString &={}) const
 
bool TrackGroupProgress (int whichGroup, double frac, const TranslatableString &={}) const
 
int GetNumWaveTracks () const
 
int GetNumWaveGroups () const
 
void GetBounds (const WaveTrack &track, sampleCount *start, sampleCount *len)
 
- Protected Member Functions inherited from EffectBase
virtual bool CheckWhetherSkipEffect (const EffectSettings &settings) const =0
 After Init(), tell whether Process() should be skipped. More...
 
void SetLinearEffectFlag (bool linearEffectFlag)
 
void SetPreviewFullSelectionFlag (bool previewDurationFlag)
 
bool IsPreviewing () const
 
const TrackListinputTracks () const
 
const AudacityProjectFindProject () const
 

Protected Attributes

wxTextCtrl * mCommandText
 
- Protected Attributes inherited from NyquistBase
wxString mXlispPath
 
wxFileName mFileName
 Name of the Nyquist script file this effect is loaded from. More...
 
wxDateTime mFileModified
 When the script was last modified on disk. More...
 
bool mStop
 
bool mBreak
 
bool mCont
 
bool mFoundType
 
bool mCompiler
 
bool mTrace
 
bool mIsSal
 
bool mExternal
 
bool mIsSpectral
 
bool mIsTool
 
const bool mIsPrompt
 
bool mOK
 
TranslatableString mInitError
 
wxString mInputCmd
 
wxString mParameters
 
wxString mCmd
 
TranslatableString mName
 Name of the Effect (untranslated) More...
 
TranslatableString mPromptName
 
TranslatableString mAction
 
TranslatableString mInfo
 
TranslatableString mAuthor
 
TranslatableString mReleaseVersion
 
TranslatableString mCopyright
 
wxString mManPage
 
wxString mHelpFile
 
bool mHelpFileExists
 
FilePath mHelpPage
 
EffectType mType
 
EffectType mPromptType
 
bool mEnablePreview
 
bool mDebugButton
 
bool mDebug
 
bool mRedirectOutput
 
bool mProjectChanged
 
wxString mDebugOutputStr
 
TranslatableString mDebugOutput
 
int mVersion
 
sampleCount mMaxLen
 
int mTrackIndex
 
bool mFirstInGroup
 
double mOutputTime
 
unsigned mCount
 
unsigned mNumSelectedChannels
 
wxArrayString mCategories
 
wxString mProps
 
wxString mPerTrackProps
 
bool mRestoreSplits
 
int mMergeClips
 
- Protected Attributes inherited from EffectBase
double mF0 {}
 
double mF1 {}
 
wxArrayString mPresetNames
 
unsigned mUIFlags { 0 }
 

Private Member Functions

void BuildPromptWindow (ShuttleGui &S)
 
void BuildEffectWindow (ShuttleGui &S)
 
bool TransferDataToPromptWindow ()
 
bool TransferDataToEffectWindow ()
 
bool TransferDataFromPromptWindow ()
 
bool TransferDataFromEffectWindow ()
 
int ShowHostInterface (EffectBase &plugin, wxWindow &parent, const EffectDialogFactory &factory, std::shared_ptr< EffectInstance > &pInstance, EffectSettingsAccess &access, bool forceModal=false) override
 
std::unique_ptr< EffectEditorPopulateOrExchange (ShuttleGui &S, EffectInstance &instance, EffectSettingsAccess &access, const EffectOutputs *pOutputs) override
 Add controls to effect panel; always succeeds. More...
 
bool TransferDataToWindow (const EffectSettings &settings) override
 
bool TransferDataFromWindow (EffectSettings &settings) override
 

Private Attributes

wxWeakRef< wxWindow > mUIParent {}
 

Additional Inherited Members

- Public Types inherited from StatefulEffectBase
using MessagePackage = EffectInstance::MessagePackage
 
- Public Types inherited from EffectPlugin
using EffectSettingsAccessPtr = std::shared_ptr< EffectSettingsAccess >
 
using InstancePointer = std::shared_ptr< EffectInstanceEx >
 
using InstanceFinder = std::function< std::optional< InstancePointer >(EffectSettings &settings) >
 
- Public Types inherited from EffectDefinitionInterface
enum class  RealtimeSince : unsigned { Never , After_3_1 , Always }
 In which versions of Audacity was an effect realtime capable? More...
 
- Public Types inherited from EffectUIServices
enum  : long { DefaultMessageBoxStyle = wxOK | wxCENTRE }
 
- Static Public Member Functions inherited from EffectWithSettings< NyquistSettings, StatefulEffect >
static NyquistSettingsGetSettings (EffectSettings &settings)
 Assume settings originated from MakeSettings() and copies thereof. More...
 
static const NyquistSettingsGetSettings (const EffectSettings &settings)
 Assume settings originated from MakeSettings() and copies thereof. More...
 
static NyquistSettingsFetchParameters (StatefulEffect &, EffectSettings &s)
 
- Static Public Member Functions inherited from Effect
static EffectFetchParameters (Effect &e, EffectSettings &)
 
- Static Public Member Functions inherited from EffectBase
static std::optional< InstancePointerFindInstance (EffectPlugin &plugin)
 
static InstanceFinder DefaultInstanceFinder (EffectPlugin &plugin)
 
- Static Public Member Functions inherited from EffectDefinitionInterface
static Identifier GetSquashedName (const Identifier &ident)
 A utility that strips spaces and CamelCases a name. More...
 
- Static Public Member Functions inherited from EffectUIServices
static int DoMessageBox (const EffectPlugin &plugin, const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})
 
- Public Attributes inherited from NyquistBase
std::vector< NyqControlmControls
 
- Public Attributes inherited from EffectBase
std::shared_ptr< TrackListmTracks {}
 
int mNumTracks {}
 
BasicUI::ProgressDialogmProgress {}
 
double mProjectRate {}
 
WaveTrackFactorymFactory {}
 
double mT0 {}
 
double mT1 {}
 
bool mIsPreview { false }
 
- Static Public Attributes inherited from EffectPlugin
static const wxString kUserPresetIdent = wxT("User Preset:")
 
static const wxString kFactoryPresetIdent = wxT("Factory Preset:")
 
static const wxString kCurrentSettingsIdent = wxT("<Current Settings>")
 
static const wxString kFactoryDefaultsIdent = wxT("<Factory Defaults>")
 
- Static Protected Member Functions inherited from NyquistBase
static double GetCtrlValue (const wxString &s)
 
static void resolveFilePath (wxString &path, FileExtension extension={})
 

Detailed Description

Definition at line 25 of file Nyquist.h.

Member Function Documentation

◆ BuildEffectWindow()

void NyquistEffect::BuildEffectWindow ( ShuttleGui S)
private

Definition at line 444 of file Nyquist.cpp.

445{
446 wxScrolledWindow *scroller = S.Style(wxVSCROLL | wxTAB_TRAVERSAL)
447 .StartScroller(2);
448 {
449 S.StartMultiColumn(4);
450 {
451 for (size_t i = 0; i < mControls.size(); i++)
452 {
453 NyqControl & ctrl = mControls[i];
454
455 if (ctrl.type == NYQ_CTRL_TEXT)
456 {
457 S.EndMultiColumn();
458 S.StartHorizontalLay(wxALIGN_LEFT, 0);
459 {
460 S.AddSpace(0, 10);
461 S.AddFixedText( Verbatim( ctrl.label ), false );
462 }
463 S.EndHorizontalLay();
464 S.StartMultiColumn(4);
465 }
466 else
467 {
468 auto prompt = XXO("%s:").Format( ctrl.name );
469 S.AddPrompt( prompt );
470
471 if (ctrl.type == NYQ_CTRL_STRING)
472 {
473 S.AddSpace(10, 10);
474
475 auto item = S.Id(ID_Text + i)
476 .Validator<wxGenericValidator>(&ctrl.valStr)
477 .Name( prompt )
478 .AddTextBox( {}, wxT(""), 50);
479 }
480 else if (ctrl.type == NYQ_CTRL_CHOICE)
481 {
482 S.AddSpace(10, 10);
483
484 S.Id(ID_Choice + i).AddChoice( {},
485 Msgids( ctrl.choices.data(), ctrl.choices.size() ) );
486 }
487 else if (ctrl.type == NYQ_CTRL_TIME)
488 {
489 S.AddSpace(10, 10);
490
491 const auto options = NumericTextCtrl::Options{}
492 .AutoPos(true)
493 .MenuEnabled(true)
494 .ReadOnly(false);
495
498 S.GetParent(), (ID_Time + i),
501 ctrl.val,
502 options);
503 S
504 .Name( prompt )
505 .Position(wxALIGN_LEFT | wxALL)
506 .AddWindow(time);
507 }
508 else if (ctrl.type == NYQ_CTRL_FILE)
509 {
510 S.AddSpace(10, 10);
511
512 // Get default file extension if specified in wildcards
513 FileExtension defaultExtension;
514 if (!ctrl.fileTypes.empty()) {
515 const auto &type = ctrl.fileTypes[0];
516 if ( !type.extensions.empty() )
517 defaultExtension = type.extensions[0];
518 }
519 resolveFilePath(ctrl.valStr, defaultExtension);
520
521 wxTextCtrl *item = S.Id(ID_Text+i)
522 .Name( prompt )
523 .AddTextBox( {}, wxT(""), 40);
524 item->SetValidator(wxGenericValidator(&ctrl.valStr));
525
526 if (ctrl.label.empty())
527 // We'd expect wxFileSelectorPromptStr to already be translated, but apparently not.
528 ctrl.label = wxGetTranslation( wxFileSelectorPromptStr );
529 S.Id(ID_FILE + i).AddButton(
530 Verbatim(ctrl.label), wxALIGN_LEFT);
531 }
532 else
533 {
534 // Integer or Real
535 if (ctrl.type == NYQ_CTRL_INT_TEXT || ctrl.type == NYQ_CTRL_FLOAT_TEXT)
536 {
537 S.AddSpace(10, 10);
538 }
539
540 S.Id(ID_Text+i);
541 if (ctrl.type == NYQ_CTRL_FLOAT || ctrl.type == NYQ_CTRL_FLOAT_TEXT)
542 {
543 double range = ctrl.high - ctrl.low;
544 S.Validator<FloatingPointValidator<double>>(
545 // > 12 decimal places can cause rounding errors in display.
546 12, &ctrl.val,
547 // Set number of decimal places
548 (range < 10
549 ? NumValidatorStyle::THREE_TRAILING_ZEROES
550 : range < 100
551 ? NumValidatorStyle::TWO_TRAILING_ZEROES
552 : NumValidatorStyle::ONE_TRAILING_ZERO),
553 ctrl.low, ctrl.high
554 );
555 }
556 else
557 {
558 S.Validator<IntegerValidator<double>>(
559 &ctrl.val, NumValidatorStyle::DEFAULT,
560 (int) ctrl.low, (int) ctrl.high);
561 }
562 wxTextCtrl *item = S
563 .Name( prompt )
564 .AddTextBox( {}, wxT(""),
565 (ctrl.type == NYQ_CTRL_INT_TEXT ||
566 ctrl.type == NYQ_CTRL_FLOAT_TEXT) ? 25 : 12);
567
568 if (ctrl.type == NYQ_CTRL_INT || ctrl.type == NYQ_CTRL_FLOAT)
569 {
570 S.Id(ID_Slider + i)
571 .Style(wxSL_HORIZONTAL)
572 .MinSize( { 150, -1 } )
573 .AddSlider( {}, 0, ctrl.ticks, 0);
574 }
575 }
576
577 if (ctrl.type != NYQ_CTRL_FILE)
578 {
579 if (ctrl.type == NYQ_CTRL_CHOICE || ctrl.label.empty())
580 {
581 S.AddSpace(10, 10);
582 }
583 else
584 {
585 S.AddUnits( Verbatim( ctrl.label ) );
586 }
587 }
588 }
589 }
590 }
591 S.EndMultiColumn();
592 }
593 S.EndScroller();
594
595 scroller->SetScrollRate(0, 20);
596
597 // This fools NVDA into not saying "Panel" when the dialog gets focus
598 scroller->SetName(wxT("\a"));
599 scroller->SetLabel(wxT("\a"));
600}
wxT("CloseDown"))
XXO("&Cut/Copy/Paste Toolbar")
wxString FileExtension
File extension, not including any leading dot.
Definition: Identifier.h:224
#define safenew
Definition: MemoryX.h:10
const NumericConverterType & NumericConverterType_TIME()
@ ID_FILE
Definition: Nyquist.cpp:63
@ ID_Choice
Definition: Nyquist.cpp:61
@ ID_Slider
Definition: Nyquist.cpp:59
ID_Text
Definition: Nyquist.cpp:72
NyquistEffect::OnText ID_Time
Definition: Nyquist.cpp:76
@ NYQ_CTRL_STRING
Definition: NyquistBase.h:32
@ NYQ_CTRL_TEXT
Definition: NyquistBase.h:36
@ NYQ_CTRL_TIME
Definition: NyquistBase.h:37
@ NYQ_CTRL_INT_TEXT
Definition: NyquistBase.h:34
@ NYQ_CTRL_INT
Definition: NyquistBase.h:30
@ NYQ_CTRL_CHOICE
Definition: NyquistBase.h:33
@ NYQ_CTRL_FLOAT_TEXT
Definition: NyquistBase.h:35
@ NYQ_CTRL_FILE
Definition: NyquistBase.h:38
@ NYQ_CTRL_FLOAT
Definition: NyquistBase.h:31
TranslatableStrings Msgids(const EnumValueSymbol strings[], size_t nStrings)
Convenience function often useful when adding choice controls.
#define S(N)
Definition: ToChars.cpp:64
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
double mProjectRate
Definition: EffectBase.h:119
virtual NumericFormatID GetSelectionFormat()
Definition: Effect.cpp:187
static FormatterContext SampleRateContext(double sampleRate)
A control on a NyquistDialog.
Definition: NyquistBase.h:42
double high
Definition: NyquistBase.h:61
wxString label
Definition: NyquistBase.h:53
wxString name
Definition: NyquistBase.h:52
std::vector< EnumValueSymbol > choices
Definition: NyquistBase.h:54
wxString valStr
Definition: NyquistBase.h:56
double low
Definition: NyquistBase.h:60
double val
Definition: NyquistBase.h:59
FileNames::FileTypes fileTypes
Definition: NyquistBase.h:55
static void resolveFilePath(wxString &path, FileExtension extension={})
std::vector< NyqControl > mControls
Definition: NyquistBase.h:287
Options & MenuEnabled(bool enable)
Options & AutoPos(bool enable)
Options & ReadOnly(bool enable)

References NumericTextCtrl::Options::AutoPos(), NyqControl::choices, NyqControl::fileTypes, Effect::GetSelectionFormat(), NyqControl::high, ID_Choice, ID_FILE, ID_Slider, ID_Text, ID_Time, NyqControl::label, NyqControl::low, NyquistBase::mControls, NumericTextCtrl::Options::MenuEnabled(), EffectBase::mProjectRate, Msgids(), NyqControl::name, NumericConverterType_TIME(), NYQ_CTRL_CHOICE, NYQ_CTRL_FILE, NYQ_CTRL_FLOAT, NYQ_CTRL_FLOAT_TEXT, NYQ_CTRL_INT, NYQ_CTRL_INT_TEXT, NYQ_CTRL_STRING, NYQ_CTRL_TEXT, NYQ_CTRL_TIME, NumericTextCtrl::Options::ReadOnly(), NyquistBase::resolveFilePath(), S, safenew, FormatterContext::SampleRateContext(), NyqControl::ticks, NyqControl::type, NyqControl::val, NyqControl::valStr, Verbatim(), wxT(), and XXO().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BuildPromptWindow()

void NyquistEffect::BuildPromptWindow ( ShuttleGui S)
private

Definition at line 412 of file Nyquist.cpp.

413{
414 S.StartVerticalLay();
415 {
416 S.StartMultiColumn(3, wxEXPAND);
417 {
418 S.SetStretchyCol(1);
419
420 S.AddVariableText(XO("Enter Nyquist Command: "));
421
422 S.AddSpace(1, 1);
423 }
424 S.EndMultiColumn();
425
426 S.StartHorizontalLay(wxEXPAND, 1);
427 {
428 mCommandText = S.Focus()
429 .MinSize( { 500, 200 } )
430 .AddTextWindow(wxT(""));
431 }
432 S.EndHorizontalLay();
433
434 S.StartHorizontalLay(wxALIGN_CENTER, 0);
435 {
436 S.Id(ID_Load).AddButton(XXO("&Load"));
437 S.Id(ID_Save).AddButton(XXO("&Save"));
438 }
439 S.EndHorizontalLay();
440 }
441 S.EndVerticalLay();
442}
XO("Cut/Copy/Paste")
@ ID_Load
Definition: Nyquist.cpp:56
@ ID_Save
Definition: Nyquist.cpp:57
wxTextCtrl * mCommandText
Definition: Nyquist.h:51

References ID_Load, ID_Save, mCommandText, S, wxT(), XO(), and XXO().

Referenced by PopulateOrExchange().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ NyquistBase()

NyquistBase::NyquistBase ( const wxString &  fName)
Parameters
fNameFile name of the Nyquist script defining this effect. If an empty string, then prompt the user for the Nyquist code to interpret.

Definition at line 112 of file NyquistBase.cpp.

57 : mIsPrompt { fName == NYQUIST_PROMPT_ID }
58{
59 mAction = XO("Applying Nyquist Effect...");
60 mExternal = false;
61 mCompiler = false;
62 mTrace = false;
63 mRedirectOutput = false;
64 mDebug = false;
65 mIsSal = false;
66 mOK = false;
67 mAuthor = XO("n/a");
68 mReleaseVersion = XO("n/a");
69 mCopyright = XO("n/a");
70
71 // set clip/split handling when applying over clip boundary.
72 mRestoreSplits = true; // Default: Restore split lines.
73 mMergeClips = -1; // Default (auto): Merge if length remains unchanged.
74
75 mVersion = 4;
76
77 mStop = false;
78 mBreak = false;
79 mCont = false;
80 mIsTool = false;
81
83
84 // Interactive Nyquist
85 if (mIsPrompt)
86 {
89 mIsTool = true;
92 mOK = true;
93 return;
94 }
95
96 if (fName == NYQUIST_WORKER_ID)
97 {
98 // Effect spawned from Nyquist Prompt
99 /* i18n-hint: It is acceptable to translate this the same as for "Nyquist
100 * Prompt" */
101 mName = XO("Nyquist Worker");
102 return;
103 }
104
105 mFileName = fName;
106 // Use the file name verbatim as effect name.
107 // This is only a default name, overridden if we find a $name line:
108 mName = Verbatim(mFileName.GetName());
109 mFileModified = mFileName.GetModificationTime();
110 ParseFile();
111
112 if (!mOK && mInitError.empty())
113 mInitError = XO("Ill-formed Nyquist plug-in header");
114}
@ EffectTypeTool
#define NYQ_MAX_LEN
Definition: NyquistBase.cpp:51
#define NYQUIST_WORKER_ID
Definition: NyquistBase.h:25
#define NYQUIST_PROMPT_ID
#define NYQUIST_PROMPT_NAME
const bool mIsPrompt
Definition: NyquistBase.h:251
bool mCompiler
Definition: NyquistBase.h:241
void ParseFile()
TranslatableString mCopyright
Definition: NyquistBase.h:267
TranslatableString mInitError
Definition: NyquistBase.h:253
TranslatableString mPromptName
Definition: NyquistBase.h:259
EffectType mType
Definition: NyquistBase.h:272
wxFileName mFileName
Name of the Nyquist script file this effect is loaded from.
Definition: NyquistBase.h:233
wxDateTime mFileModified
When the script was last modified on disk.
Definition: NyquistBase.h:234
bool mRedirectOutput
Definition: NyquistBase.h:279
TranslatableString mAction
Definition: NyquistBase.h:260
TranslatableString mReleaseVersion
Definition: NyquistBase.h:266
bool mRestoreSplits
Definition: NyquistBase.h:302
bool mExternal
Definition: NyquistBase.h:244
EffectType mPromptType
Definition: NyquistBase.h:273
TranslatableString mAuthor
Definition: NyquistBase.h:262
TranslatableString mName
Name of the Effect (untranslated)
Definition: NyquistBase.h:257
sampleCount mMaxLen
Definition: NyquistBase.h:290

◆ OnChoice()

void NyquistEffect::OnChoice ( wxCommandEvent &  evt)
protected

Definition at line 706 of file Nyquist.cpp.

707{
708 mControls[evt.GetId() - ID_Choice].val = (double) evt.GetInt();
709}

References ID_Choice, and NyquistBase::mControls.

◆ OnDebug()

void NyquistEffect::OnDebug ( wxCommandEvent &  evt)
protected

◆ OnFileButton()

void NyquistEffect::OnFileButton ( wxCommandEvent &  evt)
protected

Definition at line 742 of file Nyquist.cpp.

743{
744 int i = evt.GetId() - ID_FILE;
745 NyqControl & ctrl = mControls[i];
746
747 // Get style flags:
748 // Ensure legal combinations so that wxWidgets does not throw an assert error.
749 unsigned int flags = 0;
750 if (!ctrl.highStr.empty())
751 {
752 wxStringTokenizer tokenizer(ctrl.highStr, ",");
753 while ( tokenizer.HasMoreTokens() )
754 {
755 wxString token = tokenizer.GetNextToken().Trim(true).Trim(false);
756 if (token.IsSameAs("open", false))
757 {
758 flags |= wxFD_OPEN;
759 flags &= ~wxFD_SAVE;
760 flags &= ~wxFD_OVERWRITE_PROMPT;
761 }
762 else if (token.IsSameAs("save", false))
763 {
764 flags |= wxFD_SAVE;
765 flags &= ~wxFD_OPEN;
766 flags &= ~wxFD_MULTIPLE;
767 flags &= ~wxFD_FILE_MUST_EXIST;
768 }
769 else if (token.IsSameAs("overwrite", false) && !(flags & wxFD_OPEN))
770 {
771 flags |= wxFD_OVERWRITE_PROMPT;
772 }
773 else if (token.IsSameAs("exists", false) && !(flags & wxFD_SAVE))
774 {
775 flags |= wxFD_FILE_MUST_EXIST;
776 }
777 else if (token.IsSameAs("multiple", false) && !(flags & wxFD_SAVE))
778 {
779 flags |= wxFD_MULTIPLE;
780 }
781 }
782 }
783
785
786 wxFileName fname = ctrl.valStr;
787 wxString defaultDir = fname.GetPath();
788 wxString defaultFile = fname.GetName();
789 auto message = XO("Select a file");
790
791 if (flags & wxFD_MULTIPLE)
792 message = XO("Select one or more files");
793 else if (flags & wxFD_SAVE)
794 message = XO("Save file as");
795
796 FileDialogWrapper openFileDialog(mUIParent->FindWindow(ID_FILE + i),
797 message,
798 defaultDir,
799 defaultFile,
800 ctrl.fileTypes,
801 flags); // styles
802
803 if (openFileDialog.ShowModal() == wxID_CANCEL)
804 {
805 return;
806 }
807
808 wxString path;
809 // When multiple files selected, return file paths as a list of quoted strings.
810 if (flags & wxFD_MULTIPLE)
811 {
812 wxArrayString selectedFiles;
813 openFileDialog.GetPaths(selectedFiles);
814
815 for (size_t sf = 0; sf < selectedFiles.size(); sf++) {
816 path += "\"";
817 path += selectedFiles[sf];
818 path += "\"";
819 }
820 ctrl.valStr = path;
821 }
822 else
823 {
824 ctrl.valStr = openFileDialog.GetPath();
825 }
826
827 mUIParent->FindWindow(ID_Text + i)->GetValidator()->TransferToWindow();
828}
wxString highStr
Definition: NyquistBase.h:58
wxWeakRef< wxWindow > mUIParent
Definition: Nyquist.h:65

References NyqControl::fileTypes, FileDialog::GetPath(), FileDialog::GetPaths(), NyqControl::highStr, ID_FILE, ID_Text, NyquistBase::mControls, mUIParent, NyquistBase::resolveFilePath(), FileDialog::ShowModal(), NyqControl::valStr, and XO().

Here is the call graph for this function:

◆ OnLoad()

void NyquistEffect::OnLoad ( wxCommandEvent &  evt)
protected

Definition at line 609 of file Nyquist.cpp.

610{
611 if (mCommandText->IsModified())
612 {
613 if (wxNO == EffectUIServices::DoMessageBox(*this,
614 XO("Current program has been modified.\nDiscard changes?"),
615 wxYES_NO ) )
616 {
617 return;
618 }
619 }
620
622 mUIParent,
623 XO("Load Nyquist script"),
624 mFileName.GetPath(),
625 wxEmptyString,
626 {
627 NyquistScripts,
628 LispScripts,
629 FileNames::TextFiles,
630 FileNames::AllFiles
631 },
632 wxFD_OPEN | wxRESIZE_BORDER);
633
634 if (dlog.ShowModal() != wxID_OK)
635 {
636 return;
637 }
638
639 mFileName = dlog.GetPath();
640
641 if (!mCommandText->LoadFile(mFileName.GetFullPath()))
642 {
643 EffectUIServices::DoMessageBox(*this, XO("File could not be loaded"));
644 }
645}
static int DoMessageBox(const EffectPlugin &plugin, const TranslatableString &message, long style=DefaultMessageBoxStyle, const TranslatableString &titleStr={})

References EffectUIServices::DoMessageBox(), FileDialog::GetPath(), mCommandText, NyquistBase::mFileName, mUIParent, FileDialog::ShowModal(), and XO().

Here is the call graph for this function:

◆ OnSave()

void NyquistEffect::OnSave ( wxCommandEvent &  evt)
protected

Definition at line 647 of file Nyquist.cpp.

648{
650 mUIParent,
651 XO("Save Nyquist script"),
652 mFileName.GetPath(),
653 mFileName.GetFullName(),
654 {
655 NyquistScripts,
656 LispScripts,
657 FileNames::AllFiles
658 },
659 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
660
661 if (dlog.ShowModal() != wxID_OK)
662 {
663 return;
664 }
665
666 mFileName = dlog.GetPath();
667
668 if (!mCommandText->SaveFile(mFileName.GetFullPath()))
669 {
670 EffectUIServices::DoMessageBox(*this, XO("File could not be saved"));
671 }
672}

References EffectUIServices::DoMessageBox(), FileDialog::GetPath(), mCommandText, NyquistBase::mFileName, mUIParent, FileDialog::ShowModal(), and XO().

Here is the call graph for this function:

◆ OnSlider()

void NyquistEffect::OnSlider ( wxCommandEvent &  evt)
protected

Definition at line 674 of file Nyquist.cpp.

675{
676 int i = evt.GetId() - ID_Slider;
677 NyqControl & ctrl = mControls[i];
678
679 int val = evt.GetInt();
680 double range = ctrl.high - ctrl.low;
681 double newVal = (val / (double)ctrl.ticks) * range + ctrl.low;
682
683 // Determine precision for displayed number
684 int precision = range < 1.0 ? 3 :
685 range < 10.0 ? 2 :
686 range < 100.0 ? 1 :
687 0;
688
689 // If the value is at least one tick different from the current value
690 // change it (this prevents changes from manually entered values unless
691 // the slider actually moved)
692 if (fabs(newVal - ctrl.val) >= (1 / (double)ctrl.ticks) * range &&
693 fabs(newVal - ctrl.val) >= pow(0.1, precision) / 2)
694 {
695 // First round to the appropriate precision
696 newVal *= pow(10.0, precision);
697 newVal = floor(newVal + 0.5);
698 newVal /= pow(10.0, precision);
699
700 ctrl.val = newVal;
701
702 mUIParent->FindWindow(ID_Text + i)->GetValidator()->TransferToWindow();
703 }
704}

References NyqControl::high, ID_Slider, ID_Text, NyqControl::low, NyquistBase::mControls, mUIParent, NyqControl::ticks, and NyqControl::val.

◆ OnText()

void NyquistEffect::OnText ( wxCommandEvent &  evt)
protected

Definition at line 830 of file Nyquist.cpp.

831{
832 int i = evt.GetId() - ID_Text;
833
834 NyqControl & ctrl = mControls[i];
835
836 if (wxDynamicCast(evt.GetEventObject(), wxWindow)->GetValidator()->TransferFromWindow())
837 {
838 if (ctrl.type == NYQ_CTRL_FLOAT || ctrl.type == NYQ_CTRL_INT)
839 {
840 int pos = (int)floor((ctrl.val - ctrl.low) /
841 (ctrl.high - ctrl.low) * ctrl.ticks + 0.5);
842
843 wxSlider *slider = (wxSlider *)mUIParent->FindWindow(ID_Slider + i);
844 slider->SetValue(pos);
845 }
846 }
847}

References NyqControl::high, ID_Slider, ID_Text, NyqControl::low, NyquistBase::mControls, mUIParent, NYQ_CTRL_FLOAT, NYQ_CTRL_INT, NyqControl::ticks, NyqControl::type, and NyqControl::val.

◆ OnTime()

void NyquistEffect::OnTime ( wxCommandEvent &  evt)
protected

Definition at line 711 of file Nyquist.cpp.

712{
713 int i = evt.GetId() - ID_Time;
714 static double value = 0.0;
715 NyqControl & ctrl = mControls[i];
716
717 NumericTextCtrl *n = (NumericTextCtrl *) mUIParent->FindWindow(ID_Time + i);
718 double val = n->GetValue();
719
720 // Observed that two events transmitted on each control change (Linux)
721 // so skip if value has not changed.
722 if (val != value) {
723 if (val < ctrl.low || val > ctrl.high) {
724 const auto message = XO("Value range:\n%s to %s")
725 .Format( ToTimeFormat(ctrl.low), ToTimeFormat(ctrl.high) );
727 message,
728 wxOK | wxCENTRE,
729 XO("Value Error") );
730 }
731
732 if (val < ctrl.low)
733 val = ctrl.low;
734 else if (val > ctrl.high)
735 val = ctrl.high;
736
737 n->SetValue(val);
738 value = val;
739 }
740}
void SetValue(double newValue)
wxString ToTimeFormat(double t)

References EffectUIServices::DoMessageBox(), NumericConverter::GetValue(), NyqControl::high, ID_Time, NyqControl::low, NyquistBase::mControls, mUIParent, NumericTextCtrl::SetValue(), NyquistBase::ToTimeFormat(), and XO().

Here is the call graph for this function:

◆ PopulateOrExchange()

std::unique_ptr< EffectEditor > NyquistEffect::PopulateOrExchange ( ShuttleGui S,
EffectInstance instance,
EffectSettingsAccess access,
const EffectOutputs pOutputs 
)
overrideprivatevirtual

Add controls to effect panel; always succeeds.

Returns
if not null, then return it from PopulateUI instead of a DefaultEffectEditor; default implementation returns null

Reimplemented from StatefulEffectUIServices.

Definition at line 162 of file Nyquist.cpp.

165{
166 mUIParent = S.GetParent();
167 if (mIsPrompt)
169 else
171 return nullptr;
172}
void BuildEffectWindow(ShuttleGui &S)
Definition: Nyquist.cpp:444
void BuildPromptWindow(ShuttleGui &S)
Definition: Nyquist.cpp:412

References BuildEffectWindow(), BuildPromptWindow(), NyquistBase::mIsPrompt, mUIParent, and S.

Here is the call graph for this function:

◆ ShowHostInterface()

int NyquistEffect::ShowHostInterface ( EffectBase plugin,
wxWindow &  parent,
const EffectDialogFactory factory,
std::shared_ptr< EffectInstance > &  pInstance,
EffectSettingsAccess access,
bool  forceModal = false 
)
overrideprivatevirtual

The only non-const member function, it usually applies factory to plugin and self and given access

But there are a few unusual overrides for historical reasons that may ignore the factory.

Parameters
pInstancemay be passed to factory, and is only guaranteed to have lifetime suitable for a modal dialog, unless the dialog stores a copy of pInstance
accessis only guaranteed to have lifetime suitable for a modal dialog, unless the dialog stores access.shared_from_this()
Returns
0 if destructive effect processing should not proceed (and there may be a non-modal dialog still opened); otherwise, modal dialog return code

Reimplemented from EffectUIServices.

Referenced by EVT_COMMAND_RANGE().

Here is the caller graph for this function:

◆ TransferDataFromEffectWindow()

bool NyquistEffect::TransferDataFromEffectWindow ( )
private

Definition at line 272 of file Nyquist.cpp.

273{
274 if (mControls.size() == 0)
275 {
276 return true;
277 }
278
279 for (unsigned int i = 0; i < mControls.size(); i++)
280 {
281 NyqControl *ctrl = &mControls[i];
282
283 if (ctrl->type == NYQ_CTRL_STRING || ctrl->type == NYQ_CTRL_TEXT)
284 {
285 continue;
286 }
287
288 if (ctrl->val == UNINITIALIZED_CONTROL)
289 {
290 ctrl->val = GetCtrlValue(ctrl->valStr);
291 }
292
293 if (ctrl->type == NYQ_CTRL_CHOICE)
294 {
295 continue;
296 }
297
298 if (ctrl->type == NYQ_CTRL_FILE)
299 {
300 resolveFilePath(ctrl->valStr);
301
302 wxString path;
303 if (ctrl->valStr.StartsWith("\"", &path))
304 {
305 // Validate if a list of quoted paths.
306 if (path.EndsWith("\"", &path))
307 {
308 path.Replace("\"\"", "\"");
309 wxStringTokenizer tokenizer(path, "\"");
310 while (tokenizer.HasMoreTokens())
311 {
312 wxString token = tokenizer.GetNextToken();
313 if(!validatePath(token))
314 {
315 const auto message =
316 XO("\"%s\" is not a valid file path.").Format( token );
318 message,
319 wxOK | wxICON_EXCLAMATION | wxCENTRE,
320 XO("Error") );
321 return false;
322 }
323 }
324 continue;
325 }
326 else
327 {
328 const auto message =
329 /* i18n-hint: Warning that there is one quotation mark rather than a pair.*/
330 XO("Mismatched quotes in\n%s").Format( ctrl->valStr );
332 message,
333 wxOK | wxICON_EXCLAMATION | wxCENTRE,
334 XO("Error") );
335 return false;
336 }
337 }
338 // Validate a single path.
339 else if (validatePath(ctrl->valStr))
340 {
341 continue;
342 }
343
344 // Validation failed
345 const auto message =
346 XO("\"%s\" is not a valid file path.").Format( ctrl->valStr );
348 message,
349 wxOK | wxICON_EXCLAMATION | wxCENTRE,
350 XO("Error") );
351 return false;
352 }
353
354 if (ctrl->type == NYQ_CTRL_TIME)
355 {
356 NumericTextCtrl *n = (NumericTextCtrl *) mUIParent->FindWindow(ID_Time + i);
357 ctrl->val = n->GetValue();
358 }
359
360 if (ctrl->type == NYQ_CTRL_INT_TEXT && ctrl->lowStr.IsSameAs(wxT("nil"), false)) {
361 ctrl->low = INT_MIN;
362 }
363 else if ((ctrl->type == NYQ_CTRL_FLOAT_TEXT || ctrl->type == NYQ_CTRL_TIME) &&
364 ctrl->lowStr.IsSameAs(wxT("nil"), false))
365 {
366 ctrl->low = -(FLT_MAX);
367 }
368 else
369 {
370 ctrl->low = GetCtrlValue(ctrl->lowStr);
371 }
372
373 if (ctrl->type == NYQ_CTRL_INT_TEXT && ctrl->highStr.IsSameAs(wxT("nil"), false)) {
374 ctrl->high = INT_MAX;
375 }
376 else if ((ctrl->type == NYQ_CTRL_FLOAT_TEXT || ctrl->type == NYQ_CTRL_TIME) &&
377 ctrl->highStr.IsSameAs(wxT("nil"), false))
378 {
379 ctrl->high = FLT_MAX;
380 }
381 else
382 {
383 ctrl->high = GetCtrlValue(ctrl->highStr);
384 }
385
386 if (ctrl->high < ctrl->low)
387 {
388 ctrl->high = ctrl->low + 1;
389 }
390
391 if (ctrl->val < ctrl->low)
392 {
393 ctrl->val = ctrl->low;
394 }
395
396 if (ctrl->val > ctrl->high)
397 {
398 ctrl->val = ctrl->high;
399 }
400
401 ctrl->ticks = 1000;
402 if (ctrl->type == NYQ_CTRL_INT &&
403 (ctrl->high - ctrl->low < ctrl->ticks))
404 {
405 ctrl->ticks = (int)(ctrl->high - ctrl->low);
406 }
407 }
408
409 return true;
410}
#define UNINITIALIZED_CONTROL
Definition: NyquistBase.h:26
wxString lowStr
Definition: NyquistBase.h:57
bool validatePath(wxString path)
static double GetCtrlValue(const wxString &s)

References EffectUIServices::DoMessageBox(), NyquistBase::GetCtrlValue(), NumericConverter::GetValue(), NyqControl::high, NyqControl::highStr, ID_Time, NyqControl::low, NyqControl::lowStr, NyquistBase::mControls, mUIParent, NYQ_CTRL_CHOICE, NYQ_CTRL_FILE, NYQ_CTRL_FLOAT_TEXT, NYQ_CTRL_INT, NYQ_CTRL_INT_TEXT, NYQ_CTRL_STRING, NYQ_CTRL_TEXT, NYQ_CTRL_TIME, NyquistBase::resolveFilePath(), NyqControl::ticks, NyqControl::type, UNINITIALIZED_CONTROL, NyqControl::val, NyquistBase::validatePath(), NyqControl::valStr, wxT(), and XO().

Referenced by TransferDataFromWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransferDataFromPromptWindow()

bool NyquistEffect::TransferDataFromPromptWindow ( )
private

Definition at line 254 of file Nyquist.cpp.

255{
256 mInputCmd = mCommandText->GetValue();
257
258 // Un-correct smart quoting, bothersomely applied in wxTextCtrl by
259 // the native widget of MacOS 10.9 SDK
260 const wxString left = wxT("\u201c"), right = wxT("\u201d"), dumb = '"';
261 mInputCmd.Replace(left, dumb, true);
262 mInputCmd.Replace(right, dumb, true);
263
264 const wxString leftSingle = wxT("\u2018"), rightSingle = wxT("\u2019"),
265 dumbSingle = '\'';
266 mInputCmd.Replace(leftSingle, dumbSingle, true);
267 mInputCmd.Replace(rightSingle, dumbSingle, true);
268
269 return ParseCommand(mInputCmd);
270}
wxString mInputCmd
Definition: NyquistBase.h:254
bool ParseCommand(const wxString &cmd)

References mCommandText, NyquistBase::mInputCmd, NyquistBase::ParseCommand(), and wxT().

Referenced by TransferDataFromWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransferDataFromWindow()

bool NyquistEffect::TransferDataFromWindow ( EffectSettings settings)
overrideprivatevirtual

Update the given settings from controls; default does nothing, returns true

Reimplemented from StatefulEffectUIServices.

Definition at line 196 of file Nyquist.cpp.

197{
198 if (!mUIParent->Validate() || !mUIParent->TransferDataFromWindow())
199 {
200 return false;
201 }
202
203 if (mIsPrompt)
204 {
206 }
208}
bool TransferDataFromPromptWindow()
Definition: Nyquist.cpp:254
bool TransferDataFromEffectWindow()
Definition: Nyquist.cpp:272

References NyquistBase::mIsPrompt, mUIParent, TransferDataFromEffectWindow(), and TransferDataFromPromptWindow().

Here is the call graph for this function:

◆ TransferDataToEffectWindow()

bool NyquistEffect::TransferDataToEffectWindow ( )
private

Definition at line 217 of file Nyquist.cpp.

218{
219 for (size_t i = 0, cnt = mControls.size(); i < cnt; i++)
220 {
221 NyqControl & ctrl = mControls[i];
222
223 if (ctrl.type == NYQ_CTRL_CHOICE)
224 {
225 const auto count = ctrl.choices.size();
226
227 int val = (int)ctrl.val;
228 if (val < 0 || val >= (int)count)
229 {
230 val = 0;
231 }
232
233 wxChoice *c = (wxChoice *) mUIParent->FindWindow(ID_Choice + i);
234 c->SetSelection(val);
235 }
236 else if (ctrl.type == NYQ_CTRL_INT || ctrl.type == NYQ_CTRL_FLOAT)
237 {
238 // wxTextCtrls are handled by the validators
239 double range = ctrl.high - ctrl.low;
240 int val = (int)(0.5 + ctrl.ticks * (ctrl.val - ctrl.low) / range);
241 wxSlider *s = (wxSlider *) mUIParent->FindWindow(ID_Slider + i);
242 s->SetValue(val);
243 }
244 else if (ctrl.type == NYQ_CTRL_TIME)
245 {
246 NumericTextCtrl *n = (NumericTextCtrl *) mUIParent->FindWindow(ID_Time + i);
247 n->SetValue(ctrl.val);
248 }
249 }
250
251 return true;
252}

References NyqControl::choices, NyqControl::high, ID_Choice, ID_Slider, ID_Time, NyqControl::low, NyquistBase::mControls, mUIParent, NYQ_CTRL_CHOICE, NYQ_CTRL_FLOAT, NYQ_CTRL_INT, NYQ_CTRL_TIME, NumericTextCtrl::SetValue(), NyqControl::ticks, NyqControl::type, and NyqControl::val.

Referenced by TransferDataToWindow().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TransferDataToPromptWindow()

bool NyquistEffect::TransferDataToPromptWindow ( )
private

Definition at line 210 of file Nyquist.cpp.

211{
212 mCommandText->ChangeValue(mInputCmd);
213
214 return true;
215}

References mCommandText, and NyquistBase::mInputCmd.

Referenced by TransferDataToWindow().

Here is the caller graph for this function:

◆ TransferDataToWindow()

bool NyquistEffect::TransferDataToWindow ( const EffectSettings settings)
overrideprivatevirtual

Update controls for the settings; default does nothing, returns true

Reimplemented from StatefulEffectUIServices.

Definition at line 174 of file Nyquist.cpp.

175{
176 mUIParent->TransferDataToWindow();
177
178 bool success;
179 if (mIsPrompt)
180 {
181 success = TransferDataToPromptWindow();
182 }
183 else
184 {
185 success = TransferDataToEffectWindow();
186 }
187
188 if (success)
189 {
191 }
192
193 return success;
194}
static bool EnablePreview(wxWindow *parent, bool enable=true)
bool mEnablePreview
Definition: NyquistBase.h:275
bool TransferDataToPromptWindow()
Definition: Nyquist.cpp:210
bool TransferDataToEffectWindow()
Definition: Nyquist.cpp:217

References EffectEditor::EnablePreview(), NyquistBase::mEnablePreview, NyquistBase::mIsPrompt, mUIParent, TransferDataToEffectWindow(), and TransferDataToPromptWindow().

Here is the call graph for this function:

Member Data Documentation

◆ mCommandText

wxTextCtrl* NyquistEffect::mCommandText
protected

◆ mUIParent

wxWeakRef<wxWindow> NyquistEffect::mUIParent {}
private

The documentation for this class was generated from the following files: