diff --git a/Makefile b/Makefile index 49802fa..573c7e9 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ all: - g++ -O3 -std=c++11 -g -o inspectrum inputsource.cpp wximagepanel.cpp main.cpp `wx-config --cxxflags --libs` -lfftw3f + g++ -O3 -std=c++11 -g -o inspectrum inputsource.cpp wxspectrogram.cpp main.cpp `wx-config --cxxflags --libs` -lfftw3f clean: rm inspectrum diff --git a/main.cpp b/main.cpp index 8a60a52..12c50ea 100644 --- a/main.cpp +++ b/main.cpp @@ -4,7 +4,7 @@ #endif #include "inputsource.h" -#include "wximagepanel.h" +#include "wxspectrogram.h" class MyApp: public wxApp { @@ -58,7 +58,7 @@ bool MyApp::OnInit() return false; } - wxImagePanel *impanel = new wxImagePanel(frame, m_input_source); + wxSpectrogram *impanel = new wxSpectrogram(frame, m_input_source); sizer->Add(impanel, 1, wxALL | wxEXPAND, 0); frame->SetSizer(sizer); diff --git a/wximagepanel.cpp b/wxspectrogram.cpp similarity index 81% rename from wximagepanel.cpp rename to wxspectrogram.cpp index 060b8a4..ea5befe 100644 --- a/wximagepanel.cpp +++ b/wxspectrogram.cpp @@ -1,11 +1,11 @@ -#include "wximagepanel.h" +#include "wxspectrogram.h" -wxBEGIN_EVENT_TABLE(wxImagePanel, wxScrolled) - EVT_MOUSEWHEEL(wxImagePanel::OnMouseWheel) - EVT_SIZE(wxImagePanel::OnSize) +wxBEGIN_EVENT_TABLE(wxSpectrogram, wxScrolled) + EVT_MOUSEWHEEL(wxSpectrogram::OnMouseWheel) + EVT_SIZE(wxSpectrogram::OnSize) wxEND_EVENT_TABLE() -wxImagePanel::wxImagePanel(wxFrame *parent, InputSource *input_source) : wxScrolled(parent) +wxSpectrogram::wxSpectrogram(wxFrame *parent, InputSource *input_source) : wxScrolled(parent) { this->input_source = input_source; SetVirtualSize(input_source->GetWidth(), input_source->GetHeight()); @@ -13,12 +13,12 @@ wxImagePanel::wxImagePanel(wxFrame *parent, InputSource *input_source) : wxScrol SetScrollRate(10, 10); } -wxImagePanel::~wxImagePanel() +wxSpectrogram::~wxSpectrogram() { free(input_data); } -void wxImagePanel::AllocateBuffers() +void wxSpectrogram::AllocateBuffers() { int width, height; GetSize(&width, &height); @@ -37,7 +37,7 @@ int clamp(int a, int b, int c) { return a; } -void wxImagePanel::OnDraw(wxDC &dc) +void wxSpectrogram::OnDraw(wxDC &dc) { int x, y; int xunit, yunit; @@ -69,7 +69,7 @@ void wxImagePanel::OnDraw(wxDC &dc) dc.DrawBitmap(*image, 0, y, false); } -void wxImagePanel::OnMouseWheel(wxMouseEvent &event) +void wxSpectrogram::OnMouseWheel(wxMouseEvent &event) { if (event.ControlDown() && event.GetWheelRotation() != 0) { bool forward = event.GetWheelRotation() > 0; @@ -97,7 +97,7 @@ void wxImagePanel::OnMouseWheel(wxMouseEvent &event) } } -void wxImagePanel::OnSize(wxSizeEvent &event) +void wxSpectrogram::OnSize(wxSizeEvent &event) { AllocateBuffers(); } diff --git a/wximagepanel.h b/wxspectrogram.h similarity index 76% rename from wximagepanel.h rename to wxspectrogram.h index a5f45a3..05699de 100644 --- a/wximagepanel.h +++ b/wxspectrogram.h @@ -8,7 +8,7 @@ #include "inputsource.h" -class wxImagePanel : public wxScrolled +class wxSpectrogram : public wxScrolled { private: InputSource *input_source = nullptr; @@ -16,8 +16,8 @@ private: std::unique_ptr image; public: - wxImagePanel(wxFrame *parent, InputSource *input_source); - ~wxImagePanel(); + wxSpectrogram(wxFrame *parent, InputSource *input_source); + ~wxSpectrogram(); void AllocateBuffers();