Sabotage the once lovely friendship between FrameMain and AudioBox and use an option listener instead

Originally committed to SVN as r4906.
This commit is contained in:
Thomas Goyne 2010-12-08 08:09:11 +00:00
parent 5f39b99b78
commit 3bb1f590d7
4 changed files with 8 additions and 22 deletions

View file

@ -74,10 +74,6 @@ class ToggleBitmap;
/// @class AudioBox
/// @brief Panel with audio playback and timing controls, also containing an AudioDisplay
class AudioBox : public wxPanel {
/// @todo Get rid of this ASAP, currently required for FrameMain to be able to notify
/// audio display about renderer having changed.
friend class FrameMain;
/// The audio display in the box
AudioDisplay *audioDisplay;

View file

@ -35,9 +35,6 @@
/// @ingroup audio_ui
///
///////////
// Headers
#include "config.h"
#ifndef AGI_PRE
@ -63,11 +60,6 @@
#include "main.h"
#include "utils.h"
#undef min
#undef max
class AudioDisplayScrollbar : public AudioDisplayInteractionObject {
static const int height = 10;
@ -557,6 +549,8 @@ AudioDisplay::AudioDisplay(wxWindow *parent, AudioController *controller)
controller->AddAudioListener(this);
controller->AddTimingListener(this);
OPT_SUB("Audio/Spectrum", &AudioDisplay::ReloadRenderingSettings, this);
audio_renderer->SetAmplitudeScale(scale_amplitude);
SetZoomLevel(0);

View file

@ -140,7 +140,7 @@ private:
void SetDraggedObject(AudioDisplayInteractionObject *new_obj);
/// Leftmost pixel in the vitual audio image being displayed
/// Leftmost pixel in the virtual audio image being displayed
int scroll_left;
/// Total width of the audio in pixels
@ -182,6 +182,11 @@ private:
/// Previous audio selection for optimising redraw when selection changes
AudioController::SampleRange old_selection;
/// @brief Reload all rendering settings from Options and reset caches
///
/// This can be called if some rendering quality settings have been changed
/// in Options and need to be reloaded to take effect.
void ReloadRenderingSettings();
/// wxWidgets paint event
void OnPaint(wxPaintEvent &event);
@ -304,13 +309,6 @@ public:
float GetAmplitudeScale() const;
/// @brief Reload all rendering settings from Options and reset caches
///
/// This can be called if some rendering quality settings have been changed in Options
/// and need to be reloaded to take effect.
void ReloadRenderingSettings();
/// @brief Get a sample index from an X coordinate relative to current scroll
int64_t SamplesFromRelativeX(int x) const { return (scroll_left + x) * pixel_samples; }
/// @brief Get a sample index from an absolute X coordinate

View file

@ -681,8 +681,6 @@ void FrameMain::OnCloseAudio (wxCommandEvent&) {
/// @param event wxWidgets event object
void FrameMain::OnAudioDisplayMode (wxCommandEvent &event) {
OPT_SET("Audio/Spectrum")->SetBool(event.GetId() == Menu_Audio_Spectrum);
/// @todo Remove this reload call when the audio display starts listening for option changes
audioBox->audioDisplay->ReloadRenderingSettings();
}
#ifdef _DEBUG