| 426 | } |
| 427 | |
| 428 | void 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 | |
| 481 | bool SpectrumPrefs::Commit() |
| 482 | { |
no test coverage detected