spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit f719354bb57b6d4481976950681cb8a42f4cefab
parent 3ecdad345927a15e2c39cddab1bd843287cd0802
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Mon, 13 Aug 2012 21:51:11 -0700

Lowercase

Diffstat:
Msrc/spek-platform.cc | 4++--
Msrc/spek-platform.hh | 4++--
Msrc/spek-preferences.cc | 20++++++++++----------
Msrc/spek-preferences.hh | 16++++++++--------
Msrc/spek-spectrogram.cc | 20++++++++++----------
Msrc/spek-spectrogram.hh | 12++++++------
Msrc/spek-window.cc | 28++++++++++++++--------------
Msrc/spek-window.hh | 13++++++-------
Msrc/spek.cc | 5+++--
9 files changed, 61 insertions(+), 61 deletions(-)

diff --git a/src/spek-platform.cc b/src/spek-platform.cc @@ -24,7 +24,7 @@ #include "spek-platform.hh" -wxString SpekPlatform::ConfigPath(const wxString& app_name) +wxString SpekPlatform::config_path(const wxString& app_name) { #ifdef OS_WIN wxFileName file_name(wxStandardPaths::Get().GetUserConfigDir()); @@ -37,7 +37,7 @@ wxString SpekPlatform::ConfigPath(const wxString& app_name) return file_name.GetFullPath(); } -bool SpekPlatform::CanChangeLanguage() +bool SpekPlatform::can_change_language() { #ifdef OS_UNIX return false; diff --git a/src/spek-platform.hh b/src/spek-platform.hh @@ -26,11 +26,11 @@ class SpekPlatform { public: // Not quite XDG-compatible, but close enough. - static wxString ConfigPath(const wxString& app_name); + static wxString config_path(const wxString& app_name); // Setting non-default locale under GTK+ is tricky (see e.g. how FileZilla does it). We will // just disable the language setting for GTK+ users and will always use the system locale. - static bool CanChangeLanguage(); + static bool can_change_language(); }; extern "C" { diff --git a/src/spek-preferences.cc b/src/spek-preferences.cc @@ -22,13 +22,13 @@ #include "spek-preferences.hh" -SpekPreferences& SpekPreferences::Get() +SpekPreferences& SpekPreferences::get() { static SpekPreferences instance; return instance; } -void SpekPreferences::Init() +void SpekPreferences::init() { if (this->locale) { delete this->locale; @@ -36,7 +36,7 @@ void SpekPreferences::Init() this->locale = new wxLocale(); int lang = wxLANGUAGE_DEFAULT; - wxString code = this->GetLanguage(); + wxString code = this->get_language(); if (!code.IsEmpty()) { const wxLanguageInfo *info = wxLocale::FindLanguageInfo(code); if (info) { @@ -49,7 +49,7 @@ void SpekPreferences::Init() SpekPreferences::SpekPreferences() : locale(NULL) { - wxString path = SpekPlatform::ConfigPath(wxT("spek")); + wxString path = SpekPlatform::config_path(wxT("spek")); this->config = new wxFileConfig( wxEmptyString, wxEmptyString, @@ -60,40 +60,40 @@ SpekPreferences::SpekPreferences() : locale(NULL) ); } -bool SpekPreferences::GetCheckUpdate() +bool SpekPreferences::get_check_update() { bool result = true; this->config->Read(wxT("/update/check"), &result); return result; } -void SpekPreferences::SetCheckUpdate(bool value) +void SpekPreferences::set_check_update(bool value) { this->config->Write(wxT("/update/check"), value); this->config->Flush(); } -long SpekPreferences::GetLastUpdate() +long SpekPreferences::get_last_update() { long result = 0; this->config->Read(wxT("/update/last"), &result); return result; } -void SpekPreferences::SetLastUpdate(long value) +void SpekPreferences::set_last_update(long value) { this->config->Write(wxT("/update/last"), value); this->config->Flush(); } -wxString SpekPreferences::GetLanguage() +wxString SpekPreferences::get_language() { wxString result(wxT("")); this->config->Read(wxT("/general/language"), &result); return result; } -void SpekPreferences::SetLanguage(const wxString& value) +void SpekPreferences::set_language(const wxString& value) { this->config->Write(wxT("/general/language"), value); this->config->Flush(); diff --git a/src/spek-preferences.hh b/src/spek-preferences.hh @@ -25,15 +25,15 @@ class SpekPreferences { public: - static SpekPreferences& Get(); + static SpekPreferences& get(); - void Init(); - bool GetCheckUpdate(); - void SetCheckUpdate(bool value); - long GetLastUpdate(); - void SetLastUpdate(long value); - wxString GetLanguage(); - void SetLanguage(const wxString& value); + void init(); + bool get_check_update(); + void set_check_update(bool value); + long get_last_update(); + void set_last_update(long value); + wxString get_language(); + void set_language(const wxString& value); private: SpekPreferences(); diff --git a/src/spek-spectrogram.cc b/src/spek-spectrogram.cc @@ -21,7 +21,7 @@ #include "spek-spectrogram.hh" BEGIN_EVENT_TABLE(SpekSpectrogram, wxPanel) - EVT_PAINT(SpekSpectrogram::OnPaint) + EVT_PAINT(SpekSpectrogram::on_paint) END_EVENT_TABLE() enum @@ -45,7 +45,7 @@ SpekSpectrogram::SpekSpectrogram(wxFrame *parent) : // Pre-draw the palette. for (int y = 0; y < BANDS; y++) { - uint32_t color = GetColor(y / (double) BANDS); + uint32_t color = get_color(y / (double) BANDS); this->palette.SetRGB( wxRect(0, BANDS - y - 1, RULER, 1), color >> 16, @@ -55,23 +55,23 @@ SpekSpectrogram::SpekSpectrogram(wxFrame *parent) : } } -void SpekSpectrogram::Open(const wxString& path) +void SpekSpectrogram::open(const wxString& path) { this->path = path; - Start(); + start(); } -void SpekSpectrogram::Save(const wxString& path) +void SpekSpectrogram::save(const wxString& path) { } -void SpekSpectrogram::OnPaint(wxPaintEvent& evt) +void SpekSpectrogram::on_paint(wxPaintEvent& evt) { wxAutoBufferedPaintDC dc(this); - Render(dc); + render(dc); } -void SpekSpectrogram::Render(wxDC& dc) +void SpekSpectrogram::render(wxDC& dc) { wxSize size = GetClientSize(); int w = size.GetWidth(); @@ -122,14 +122,14 @@ void SpekSpectrogram::Render(wxDC& dc) dc.DrawBitmap(bmp, w - RPAD + GAP, TPAD); } -void SpekSpectrogram::Start() +void SpekSpectrogram::start() { } // Modified version of Dan Bruton's algorithm: // http://www.physics.sfasu.edu/astro/color/spectra.html // TODO: Move out to a C function. -uint32_t SpekSpectrogram::GetColor(double level) +uint32_t SpekSpectrogram::get_color(double level) { level *= 0.6625; double r = 0.0, g = 0.0, b = 0.0; diff --git a/src/spek-spectrogram.hh b/src/spek-spectrogram.hh @@ -25,15 +25,15 @@ class SpekSpectrogram : public wxPanel { public: SpekSpectrogram(wxFrame *parent); - void Open(const wxString& path); - void Save(const wxString& path); + void open(const wxString& path); + void save(const wxString& path); private: - void OnPaint(wxPaintEvent& evt); - void Render(wxDC& dc); + void on_paint(wxPaintEvent& evt); + void render(wxDC& dc); - void Start(); - uint32_t GetColor(double level); + void start(); + uint32_t get_color(double level); wxString path; wxString info; diff --git a/src/spek-window.cc b/src/spek-window.cc @@ -24,11 +24,11 @@ #include "spek-window.hh" BEGIN_EVENT_TABLE(SpekWindow, wxFrame) - EVT_MENU(wxID_OPEN, SpekWindow::OnOpen) - EVT_MENU(wxID_SAVE, SpekWindow::OnSave) - EVT_MENU(wxID_EXIT, SpekWindow::OnExit) - EVT_MENU(wxID_PREFERENCES, SpekWindow::OnPreferences) - EVT_MENU(wxID_ABOUT, SpekWindow::OnAbout) + EVT_MENU(wxID_OPEN, SpekWindow::on_open) + EVT_MENU(wxID_SAVE, SpekWindow::on_save) + EVT_MENU(wxID_EXIT, SpekWindow::on_exit) + EVT_MENU(wxID_PREFERENCES, SpekWindow::on_preferences) + EVT_MENU(wxID_ABOUT, SpekWindow::on_about) END_EVENT_TABLE() SpekWindow::SpekWindow(const wxString& path) : wxFrame(NULL, -1, wxEmptyString) @@ -81,7 +81,7 @@ SpekWindow::SpekWindow(const wxString& path) : wxFrame(NULL, -1, wxEmptyString) this->spectrogram = new SpekSpectrogram(this); if (!path.IsEmpty()) { - Open(path); + open(path); } } @@ -117,7 +117,7 @@ static const char *audio_extensions[] = { NULL }; -void SpekWindow::OnOpen(wxCommandEvent& WXUNUSED(event)) +void SpekWindow::on_open(wxCommandEvent& WXUNUSED(event)) { static wxString cur_dir = wxGetHomeDir(); static wxString filters = wxEmptyString; @@ -152,30 +152,30 @@ void SpekWindow::OnOpen(wxCommandEvent& WXUNUSED(event)) if (dlg->ShowModal() == wxID_OK) { cur_dir = dlg->GetDirectory(); filter_index = dlg->GetFilterIndex(); - Open(dlg->GetPath()); + open(dlg->GetPath()); } dlg->Destroy(); } -void SpekWindow::OnSave(wxCommandEvent& WXUNUSED(event)) +void SpekWindow::on_save(wxCommandEvent& WXUNUSED(event)) { } -void SpekWindow::OnExit(wxCommandEvent& WXUNUSED(event)) +void SpekWindow::on_exit(wxCommandEvent& WXUNUSED(event)) { Close(true); } -void SpekWindow::OnPreferences(wxCommandEvent& WXUNUSED(event)) +void SpekWindow::on_preferences(wxCommandEvent& WXUNUSED(event)) { } -void SpekWindow::OnAbout(wxCommandEvent& WXUNUSED(event)) +void SpekWindow::on_about(wxCommandEvent& WXUNUSED(event)) { } -void SpekWindow::Open(const wxString& path) +void SpekWindow::open(const wxString& path) { wxFileName file_name(path); if (file_name.FileExists()) { @@ -185,6 +185,6 @@ void SpekWindow::Open(const wxString& path) // TODO: make sure the above works on all platforms, both in x32 and x64. SetTitle(title); - this->spectrogram->Open(path); + this->spectrogram->open(path); } } diff --git a/src/spek-window.hh b/src/spek-window.hh @@ -29,13 +29,12 @@ public: SpekWindow(const wxString& path); private: - void OnOpen(wxCommandEvent& event); - void OnSave(wxCommandEvent& event); - void OnExit(wxCommandEvent& event); - void OnPreferences(wxCommandEvent& event); - void OnAbout(wxCommandEvent& event); - - void Open(const wxString& path); + void on_open(wxCommandEvent& event); + void on_save(wxCommandEvent& event); + void on_exit(wxCommandEvent& event); + void on_preferences(wxCommandEvent& event); + void on_about(wxCommandEvent& event); + void open(const wxString& path); SpekSpectrogram *spectrogram; diff --git a/src/spek.cc b/src/spek.cc @@ -26,11 +26,12 @@ class Spek: public wxApp { -private: +protected: virtual bool OnInit(); virtual void OnInitCmdLine(wxCmdLineParser& parser); virtual bool OnCmdLineParsed(wxCmdLineParser& parser); +private: wxString path; }; @@ -38,7 +39,7 @@ IMPLEMENT_APP(Spek) bool Spek::OnInit() { - SpekPreferences::Get().Init(); + SpekPreferences::get().init(); spek_audio_init(); if (!wxApp::OnInit()) {