MCPcopy Create free account
hub / github.com/audacity/audacity / Preview

Method Preview

src/prefs/SpectrumPrefs.cpp:428–479  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426}
427
428void SpectrumPrefs::Preview()
429{
430 if (!Validate())
431 return;
432
433 const bool isOpenPage = this->IsShown();
434
435 ShuttleGui S(this, eIsSavingToPrefs);
436 PopulateOrExchange(S);
437
438
439 mTempSettings.ConvertToActualWindowSizes();
440
441 if (mWc) {
442 if (mDefaulted) {
443 SpectrogramSettings::Reset(*mWc);
444 // ... and so that the vertical scale also defaults:
445 SpectrogramBounds::Get(*mWc).SetBounds(-1, -1);
446 }
447 else {
448 SpectrogramSettings &settings = SpectrogramSettings::Own(*mWc);
449 SpectrogramBounds::Get(*mWc)
450 .SetBounds(mTempSettings.minFreq, mTempSettings.maxFreq);
451 settings = mTempSettings;
452 }
453 }
454
455 if (!mWc || mDefaulted) {
456 SpectrogramSettings *const pSettings = &SpectrogramSettings::defaults();
457 *pSettings = mTempSettings;
458 }
459 mTempSettings.ConvertToEnumeratedWindowSizes();
460
461 // Bug 2278
462 // This code destroys any Multi-view we had.
463 // Commenting it out as it seems not to be needed.
464 /*
465 if (mWt && isOpenPage) {
466 for (auto &&channel : mWt->Channels())
467 WaveChannelView::Get(*channel)
468 .SetDisplay(WaveChannelViewConstants::Spectrum);
469 }
470 */
471
472 if (isOpenPage) {
473 if ( mProject ) {
474 auto &tp = TrackPanel::Get( *mProject );
475 tp.UpdateVRulers();
476 tp.Refresh(false);
477 }
478 }
479}
480
481bool SpectrumPrefs::Commit()
482{

Callers 2

OnPreviewMethod · 0.45
OnOKMethod · 0.45

Calls 8

GetFunction · 0.85
IsShownMethod · 0.80
UpdateVRulersMethod · 0.80
PopulateOrExchangeFunction · 0.50
SetBoundsMethod · 0.45
RefreshMethod · 0.45

Tested by

no test coverage detected