forked from mia/Aegisub
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:
parent
5f39b99b78
commit
3bb1f590d7
4 changed files with 8 additions and 22 deletions
|
@ -74,10 +74,6 @@ class ToggleBitmap;
|
||||||
/// @class AudioBox
|
/// @class AudioBox
|
||||||
/// @brief Panel with audio playback and timing controls, also containing an AudioDisplay
|
/// @brief Panel with audio playback and timing controls, also containing an AudioDisplay
|
||||||
class AudioBox : public wxPanel {
|
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
|
/// The audio display in the box
|
||||||
AudioDisplay *audioDisplay;
|
AudioDisplay *audioDisplay;
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,6 @@
|
||||||
/// @ingroup audio_ui
|
/// @ingroup audio_ui
|
||||||
///
|
///
|
||||||
|
|
||||||
|
|
||||||
///////////
|
|
||||||
// Headers
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef AGI_PRE
|
#ifndef AGI_PRE
|
||||||
|
@ -63,11 +60,6 @@
|
||||||
#include "main.h"
|
#include "main.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
||||||
|
|
||||||
#undef min
|
|
||||||
#undef max
|
|
||||||
|
|
||||||
|
|
||||||
class AudioDisplayScrollbar : public AudioDisplayInteractionObject {
|
class AudioDisplayScrollbar : public AudioDisplayInteractionObject {
|
||||||
static const int height = 10;
|
static const int height = 10;
|
||||||
|
|
||||||
|
@ -557,6 +549,8 @@ AudioDisplay::AudioDisplay(wxWindow *parent, AudioController *controller)
|
||||||
controller->AddAudioListener(this);
|
controller->AddAudioListener(this);
|
||||||
controller->AddTimingListener(this);
|
controller->AddTimingListener(this);
|
||||||
|
|
||||||
|
OPT_SUB("Audio/Spectrum", &AudioDisplay::ReloadRenderingSettings, this);
|
||||||
|
|
||||||
audio_renderer->SetAmplitudeScale(scale_amplitude);
|
audio_renderer->SetAmplitudeScale(scale_amplitude);
|
||||||
SetZoomLevel(0);
|
SetZoomLevel(0);
|
||||||
|
|
||||||
|
|
|
@ -140,7 +140,7 @@ private:
|
||||||
void SetDraggedObject(AudioDisplayInteractionObject *new_obj);
|
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;
|
int scroll_left;
|
||||||
|
|
||||||
/// Total width of the audio in pixels
|
/// Total width of the audio in pixels
|
||||||
|
@ -182,6 +182,11 @@ private:
|
||||||
/// Previous audio selection for optimising redraw when selection changes
|
/// Previous audio selection for optimising redraw when selection changes
|
||||||
AudioController::SampleRange old_selection;
|
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
|
/// wxWidgets paint event
|
||||||
void OnPaint(wxPaintEvent &event);
|
void OnPaint(wxPaintEvent &event);
|
||||||
|
@ -304,13 +309,6 @@ public:
|
||||||
float GetAmplitudeScale() const;
|
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
|
/// @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; }
|
int64_t SamplesFromRelativeX(int x) const { return (scroll_left + x) * pixel_samples; }
|
||||||
/// @brief Get a sample index from an absolute X coordinate
|
/// @brief Get a sample index from an absolute X coordinate
|
||||||
|
|
|
@ -681,8 +681,6 @@ void FrameMain::OnCloseAudio (wxCommandEvent&) {
|
||||||
/// @param event wxWidgets event object
|
/// @param event wxWidgets event object
|
||||||
void FrameMain::OnAudioDisplayMode (wxCommandEvent &event) {
|
void FrameMain::OnAudioDisplayMode (wxCommandEvent &event) {
|
||||||
OPT_SET("Audio/Spectrum")->SetBool(event.GetId() == Menu_Audio_Spectrum);
|
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
|
#ifdef _DEBUG
|
||||||
|
|
Loading…
Reference in a new issue