Audio display cosmetics

This commit is contained in:
Thomas Goyne 2012-10-02 07:25:29 -07:00
parent 55bdbf8d48
commit 3d3a74c5d2
2 changed files with 7 additions and 36 deletions

View File

@ -591,21 +591,24 @@ AudioDisplay::AudioDisplay(wxWindow *parent, AudioController *controller, agi::C
Bind(wxEVT_MOTION, &AudioDisplay::OnMouseEvent, this);
Bind(wxEVT_ENTER_WINDOW, &AudioDisplay::OnMouseEvent, this);
Bind(wxEVT_LEAVE_WINDOW, &AudioDisplay::OnMouseEvent, this);
Bind(wxEVT_PAINT, &AudioDisplay::OnPaint, this);
Bind(wxEVT_SIZE, &AudioDisplay::OnSize, this);
Bind(wxEVT_KILL_FOCUS, &AudioDisplay::OnFocus, this);
Bind(wxEVT_SET_FOCUS, &AudioDisplay::OnFocus, this);
Bind(wxEVT_CHAR_HOOK, &AudioDisplay::OnKeyDown, this);
Bind(wxEVT_KEY_DOWN, &AudioDisplay::OnKeyDown, this);
scroll_timer.Bind(wxEVT_TIMER, &AudioDisplay::OnScrollTimer, this);
}
AudioDisplay::~AudioDisplay()
{
}
void AudioDisplay::ScrollBy(int pixel_amount)
{
ScrollPixelToLeft(scroll_left + pixel_amount);
}
void AudioDisplay::ScrollPixelToLeft(int pixel_position)
{
const int client_width = GetClientRect().GetWidth();
@ -621,7 +624,6 @@ void AudioDisplay::ScrollPixelToLeft(int pixel_position)
Refresh();
}
void AudioDisplay::ScrollTimeRangeInView(const TimeRange &range)
{
int client_width = GetClientRect().GetWidth();
@ -689,13 +691,6 @@ void AudioDisplay::SetZoomLevel(int new_zoom_level)
}
}
int AudioDisplay::GetZoomLevel() const
{
return zoom_level;
}
wxString AudioDisplay::GetZoomLevelDescription(int level) const
{
const int factor = GetZoomLevelFactor(level);
@ -705,7 +700,6 @@ wxString AudioDisplay::GetZoomLevelDescription(int level) const
return wxString::Format(_("%d%%, %d pixel/second"), factor, second_pixels);
}
int AudioDisplay::GetZoomLevelFactor(int level)
{
int factor = 100;
@ -729,7 +723,6 @@ int AudioDisplay::GetZoomLevelFactor(int level)
return factor;
}
void AudioDisplay::SetAmplitudeScale(float scale)
{
audio_renderer->SetAmplitudeScale(scale);
@ -775,18 +768,6 @@ void AudioDisplay::ReloadRenderingSettings()
Refresh();
}
BEGIN_EVENT_TABLE(AudioDisplay, wxWindow)
EVT_PAINT(AudioDisplay::OnPaint)
EVT_SIZE(AudioDisplay::OnSize)
EVT_SET_FOCUS(AudioDisplay::OnFocus)
EVT_KILL_FOCUS(AudioDisplay::OnFocus)
EVT_CHAR_HOOK(AudioDisplay::OnKeyDown)
EVT_KEY_DOWN(AudioDisplay::OnKeyDown)
END_EVENT_TABLE()
void AudioDisplay::OnPaint(wxPaintEvent&)
{
if (!audio_renderer_provider) return;
@ -999,13 +980,11 @@ void AudioDisplay::SetTrackCursor(int new_pos, bool show_time)
}
}
void AudioDisplay::RemoveTrackCursor()
{
SetTrackCursor(-1, false);
}
void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
{
// If we have focus, we get mouse move events on Mac even when the mouse is
@ -1051,7 +1030,6 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
{
SetCursor(wxCursor(wxCURSOR_SIZEWE));
new_obj = timeline.get();
}
if (new_obj)
@ -1146,14 +1124,12 @@ void AudioDisplay::OnSize(wxSizeEvent &)
Refresh();
}
void AudioDisplay::OnFocus(wxFocusEvent &)
{
// The scrollbar indicates focus so repaint that
RefreshRect(scrollbar->GetBounds(), false);
}
void AudioDisplay::OnAudioOpen(AudioProvider *provider)
{
if (!audio_renderer_provider)

View File

@ -231,7 +231,6 @@ public:
AudioDisplay(wxWindow *parent, AudioController *controller, agi::Context *context);
~AudioDisplay();
/// @brief Scroll the audio display
/// @param pixel_amount Number of pixels to scroll the view
///
@ -296,7 +295,7 @@ public:
/// @return The zoom level
///
/// See SetZoomLevel for a description of zoom levels.
int GetZoomLevel() const;
int GetZoomLevel() const { return zoom_level; }
/// @brief Get a textual description of a zoom level
/// @param level The zoom level to describe
@ -317,7 +316,6 @@ public:
/// Too negative numbers get clamped.
static int GetZoomLevelFactor(int level);
/// @brief Set amplitude scale factor
/// @param scale New amplitude scale factor, 1.0 is no scaling
void SetAmplitudeScale(float scale);
@ -330,7 +328,4 @@ public:
int RelativeXFromTime(int ms) const { return int(ms / ms_per_pixel) - scroll_left; }
/// Get an absolute X coordinate from a time in milliseconds
int AbsoluteXFromTime(int ms) const { return int(ms / ms_per_pixel); }
DECLARE_EVENT_TABLE()
};