commit 8c4f672e106aed5bbe81a7bd9dff3a8f7b2c9132
parent 2c44de0e9ee3d34a516b5351cb801d0b6975a5f1
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Fri, 17 Jan 2014 13:34:21 -0800
Require wxWidgets 2.9+
Diffstat:
8 files changed, 86 insertions(+), 100 deletions(-)
diff --git a/configure.ac b/configure.ac
@@ -51,7 +51,7 @@ PKG_CHECK_MODULES(AVCODEC, [libavcodec >= 53.25])
PKG_CHECK_MODULES(AVUTIL, [libavutil >= 51.17])
AM_OPTIONS_WXCONFIG
-reqwx=2.8.0
+reqwx=2.9.4
AM_PATH_WXCONFIG($reqwx, wx=1)
if test "$wx" != 1; then
AC_MSG_ERROR([
diff --git a/src/spek-artwork.cc b/src/spek-artwork.cc
@@ -25,9 +25,7 @@ class SpekArtProvider : public wxArtProvider
{
protected:
virtual wxBitmap CreateBitmap(const wxArtID& id, const wxArtClient& client, const wxSize& size);
-#if wxCHECK_VERSION(2, 9, 0)
virtual wxIconBundle CreateIconBundle(const wxArtID& id, const wxArtClient& client);
-#endif
};
wxBitmap SpekArtProvider::CreateBitmap(
@@ -35,73 +33,71 @@ wxBitmap SpekArtProvider::CreateBitmap(
{
#ifdef OS_UNIX
if (id == ART_SPEK) {
- return wxArtProvider::GetBitmap(wxT("spek"), client, size);
+ return wxArtProvider::GetBitmap("spek", client, size);
}
if (id == ART_HELP) {
- return wxArtProvider::GetBitmap(wxT("gtk-help"), client, size);
+ return wxArtProvider::GetBitmap("gtk-help", client, size);
}
if (id == ART_OPEN) {
- return wxArtProvider::GetBitmap(wxT("gtk-open"), client, size);
+ return wxArtProvider::GetBitmap("gtk-open", client, size);
}
if (id == ART_SAVE) {
- return wxArtProvider::GetBitmap(wxT("gtk-save"), client, size);
+ return wxArtProvider::GetBitmap("gtk-save", client, size);
}
if (id == ART_CLOSE) {
- return wxArtProvider::GetBitmap(wxT("gtk-close"), client, size);
+ return wxArtProvider::GetBitmap("gtk-close", client, size);
}
#endif
#ifdef OS_WIN
if (id == ART_HELP) {
- return wxIcon(wxT("help"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
+ return wxIcon("help", wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
}
if (id == ART_OPEN) {
- return wxIcon(wxT("open"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
+ return wxIcon("open", wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
}
if (id == ART_SAVE) {
- return wxIcon(wxT("save"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
+ return wxIcon("save", wxBITMAP_TYPE_ICO_RESOURCE, 24, 24);
}
if (id == ART_CLOSE) {
- return wxIcon(wxT("close"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
+ return wxIcon("close", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16);
}
#endif
#ifdef OS_OSX
if (id == ART_HELP) {
- return wxBitmap(wxT("help"), wxBITMAP_TYPE_PNG_RESOURCE);
+ return wxBitmap("help", wxBITMAP_TYPE_PNG_RESOURCE);
}
if (id == ART_OPEN) {
- return wxBitmap(wxT("open"), wxBITMAP_TYPE_PNG_RESOURCE);
+ return wxBitmap("open", wxBITMAP_TYPE_PNG_RESOURCE);
}
if (id == ART_SAVE) {
- return wxBitmap(wxT("save"), wxBITMAP_TYPE_PNG_RESOURCE);
+ return wxBitmap("save", wxBITMAP_TYPE_PNG_RESOURCE);
}
if (id == ART_CLOSE) {
- return wxBitmap(wxT("close"), wxBITMAP_TYPE_PNG_RESOURCE);
+ return wxBitmap("close", wxBITMAP_TYPE_PNG_RESOURCE);
}
#endif
return wxNullBitmap;
}
-#if wxCHECK_VERSION(2, 9, 0)
wxIconBundle SpekArtProvider::CreateIconBundle(const wxArtID& id, const wxArtClient& client)
{
#ifdef OS_UNIX
if (id == ART_SPEK) {
- return wxArtProvider::GetIconBundle(wxT("spek"), client);
+ return wxArtProvider::GetIconBundle("spek", client);
}
#endif
#ifdef OS_WIN
if (id == ART_SPEK) {
wxIconBundle bundle;
- bundle.AddIcon(wxIcon(wxT("aaaa"), wxBITMAP_TYPE_ICO_RESOURCE, 16, 16));
- bundle.AddIcon(wxIcon(wxT("aaaa"), wxBITMAP_TYPE_ICO_RESOURCE, 24, 24));
- bundle.AddIcon(wxIcon(wxT("aaaa"), wxBITMAP_TYPE_ICO_RESOURCE, 32, 32));
- bundle.AddIcon(wxIcon(wxT("aaaa"), wxBITMAP_TYPE_ICO_RESOURCE, 48, 48));
+ bundle.AddIcon(wxIcon("aaaa", wxBITMAP_TYPE_ICO_RESOURCE, 16, 16));
+ bundle.AddIcon(wxIcon("aaaa", wxBITMAP_TYPE_ICO_RESOURCE, 24, 24));
+ bundle.AddIcon(wxIcon("aaaa", wxBITMAP_TYPE_ICO_RESOURCE, 32, 32));
+ bundle.AddIcon(wxIcon("aaaa", wxBITMAP_TYPE_ICO_RESOURCE, 48, 48));
return bundle;
}
#endif
return wxNullIconBundle;
}
-#endif
void spek_artwork_init()
{
diff --git a/src/spek-artwork.h b/src/spek-artwork.h
@@ -19,13 +19,11 @@
#ifndef SPEK_ARTWORK_H_
#define SPEK_ARTWORK_H_
-#include <wx/string.h>
-
-#define ART_SPEK wxT("art-spek")
-#define ART_OPEN wxT("art-open")
-#define ART_SAVE wxT("art-save")
-#define ART_HELP wxT("art-help")
-#define ART_CLOSE wxT("art-close")
+#define ART_SPEK "art-spek"
+#define ART_OPEN "art-open"
+#define ART_SAVE "art-save"
+#define ART_HELP "art-help"
+#define ART_CLOSE "art-close"
void spek_artwork_init();
diff --git a/src/spek-platform.cc b/src/spek-platform.cc
@@ -43,11 +43,11 @@ wxString spek_platform_config_path(const wxString& app_name)
wxFileName file_name(wxStandardPaths::Get().GetUserConfigDir(), wxEmptyString);
#else
wxFileName file_name(wxGetHomeDir(), wxEmptyString);
- file_name.AppendDir(wxT(".config"));
+ file_name.AppendDir(".config");
#endif
file_name.AppendDir(app_name);
file_name.Mkdir(0755, wxPATH_MKDIR_FULL);
- file_name.SetFullName(wxT("preferences"));
+ file_name.SetFullName("preferences");
return file_name.GetFullPath();
}
diff --git a/src/spek-preferences.cc b/src/spek-preferences.cc
@@ -44,12 +44,12 @@ void SpekPreferences::init()
}
}
this->locale->Init(lang);
- this->locale->AddCatalog(wxT(GETTEXT_PACKAGE));
+ this->locale->AddCatalog(GETTEXT_PACKAGE);
}
SpekPreferences::SpekPreferences() : locale(NULL)
{
- wxString path = spek_platform_config_path(wxT("spek"));
+ wxString path = spek_platform_config_path("spek");
this->config = new wxFileConfig(
wxEmptyString,
wxEmptyString,
@@ -63,38 +63,38 @@ SpekPreferences::SpekPreferences() : locale(NULL)
bool SpekPreferences::get_check_update()
{
bool result = true;
- this->config->Read(wxT("/update/check"), &result);
+ this->config->Read("/update/check", &result);
return result;
}
void SpekPreferences::set_check_update(bool value)
{
- this->config->Write(wxT("/update/check"), value);
+ this->config->Write("/update/check", value);
this->config->Flush();
}
long SpekPreferences::get_last_update()
{
long result = 0;
- this->config->Read(wxT("/update/last"), &result);
+ this->config->Read("/update/last", &result);
return result;
}
void SpekPreferences::set_last_update(long value)
{
- this->config->Write(wxT("/update/last"), value);
+ this->config->Write("/update/last", value);
this->config->Flush();
}
wxString SpekPreferences::get_language()
{
- wxString result(wxT(""));
- this->config->Read(wxT("/general/language"), &result);
+ wxString result("");
+ this->config->Read("/general/language", &result);
return result;
}
void SpekPreferences::set_language(const wxString& value)
{
- this->config->Write(wxT("/general/language"), value);
+ this->config->Write("/general/language", value);
this->config->Flush();
}
diff --git a/src/spek-spectrogram.cc b/src/spek-spectrogram.cc
@@ -183,7 +183,7 @@ void SpekSpectrogram::on_have_sample(SpekHaveSampleEvent& event)
static wxString time_formatter(int unit)
{
// TODO: i18n
- return wxString::Format(wxT("%d:%02d"), unit / 60, unit % 60);
+ return wxString::Format("%d:%02d", unit / 60, unit % 60);
}
static wxString freq_formatter(int unit)
@@ -220,27 +220,27 @@ void SpekSpectrogram::render(wxDC& dc)
wxFont small_font = wxFont(normal_font);
small_font.SetPointSize((int)round(8 * spek_platform_font_scale()));
dc.SetFont(normal_font);
- int normal_height = dc.GetTextExtent(wxT("dummy")).GetHeight();
+ int normal_height = dc.GetTextExtent("dummy").GetHeight();
dc.SetFont(large_font);
- int large_height = dc.GetTextExtent(wxT("dummy")).GetHeight();
+ int large_height = dc.GetTextExtent("dummy").GetHeight();
dc.SetFont(small_font);
- int small_height = dc.GetTextExtent(wxT("dummy")).GetHeight();
+ int small_height = dc.GetTextExtent("dummy").GetHeight();
// Clean the background.
dc.Clear();
// Spek version
dc.SetFont(large_font);
- wxString package_name(wxT(PACKAGE_NAME));
+ wxString package_name(PACKAGE_NAME);
dc.DrawText(
package_name,
w - RPAD + GAP,
TPAD - 2 * GAP - normal_height - large_height
);
- int package_name_width = dc.GetTextExtent(package_name + wxT(" ")).GetWidth();
+ int package_name_width = dc.GetTextExtent(package_name + " ").GetWidth();
dc.SetFont(small_font);
dc.DrawText(
- wxT(PACKAGE_VERSION),
+ PACKAGE_VERSION,
w - RPAD + GAP + package_name_width,
TPAD - 2 * GAP - normal_height - small_height
);
@@ -278,7 +278,7 @@ void SpekSpectrogram::render(wxDC& dc)
h - BPAD,
SpekRuler::BOTTOM,
// TODO: i18n
- wxT("00:00"),
+ "00:00",
time_factors,
0,
(int)this->duration,
@@ -407,7 +407,7 @@ static wxString trim(wxDC& dc, const wxString& s, int length, bool trim_end)
}
// Binary search FTW!
- wxString fix(wxT("..."));
+ wxString fix("...");
int i = 0;
int k = s.length();
while (k - i > 1) {
diff --git a/src/spek-window.cc b/src/spek-window.cc
@@ -75,13 +75,9 @@ SpekWindow::SpekWindow(const wxString& path) :
this->description = _("Spek - Acoustic Spectrum Analyser");
SetTitle(this->description);
-#if wxCHECK_VERSION(2, 9, 0)
#ifndef OS_OSX
SetIcons(wxArtProvider::GetIconBundle(ART_SPEK, wxART_FRAME_ICON));
#endif
-#else
- SetIcon(wxArtProvider::GetIcon(ART_SPEK, wxART_FRAME_ICON, wxSize(48, 48)));
-#endif
wxMenuBar *menu = new wxMenuBar();
@@ -96,16 +92,16 @@ SpekWindow::SpekWindow(const wxString& path) :
wxMenu *menu_edit = new wxMenu();
wxMenuItem *menu_edit_prefs = new wxMenuItem(menu_edit, wxID_PREFERENCES);
- menu_edit_prefs->SetItemLabel(menu_edit_prefs->GetItemLabelText() + wxT("\tCtrl-E"));
+ menu_edit_prefs->SetItemLabel(menu_edit_prefs->GetItemLabelText() + "\tCtrl-E");
menu_edit->Append(menu_edit_prefs);
menu->Append(menu_edit, _("&Edit"));
wxMenu *menu_help = new wxMenu();
wxMenuItem *menu_help_contents = new wxMenuItem(
- menu_help, wxID_HELP, wxString(_("&Help")) + wxT("\tF1"));
+ menu_help, wxID_HELP, wxString(_("&Help")) + "\tF1");
menu_help->Append(menu_help_contents);
wxMenuItem *menu_help_about = new wxMenuItem(menu_help, wxID_ABOUT);
- menu_help_about->SetItemLabel(menu_help_about->GetItemLabelText() + wxT("\tShift-F1"));
+ menu_help_about->SetItemLabel(menu_help_about->GetItemLabelText() + "\tShift-F1");
menu_help->Append(menu_help_about);
menu->Append(menu_help, _("&Help"));
@@ -124,7 +120,6 @@ SpekWindow::SpekWindow(const wxString& path) :
wxArtProvider::GetBitmap(ART_SAVE, wxART_TOOLBAR),
menu_file_save->GetItemLabelText()
);
-#if wxCHECK_VERSION(2, 9, 1)
toolbar->AddStretchableSpace();
toolbar->AddTool(
wxID_HELP,
@@ -132,7 +127,6 @@ SpekWindow::SpekWindow(const wxString& path) :
wxArtProvider::GetBitmap(ART_HELP, wxART_TOOLBAR),
_("Help")
);
-#endif
toolbar->Realize();
wxSizer *sizer = new wxBoxSizer(wxVERTICAL);
@@ -230,14 +224,14 @@ void SpekWindow::on_open(wxCommandEvent&)
if (filters.IsEmpty()) {
filters.Alloc(1024);
filters += _("All files");
- filters += wxT("|*.*|");
+ filters += "|*.*|";
filters += _("Audio files");
- filters += wxT("|");
+ filters += "|";
for (int i = 0; audio_extensions[i]; ++i) {
if (i) {
- filters += wxT(";");
+ filters += ";";
}
- filters += wxT("*.");
+ filters += "*.";
filters += wxString::FromAscii(audio_extensions[i]);
}
filters.Shrink();
@@ -268,7 +262,7 @@ void SpekWindow::on_save(wxCommandEvent&)
if (filters.IsEmpty()) {
filters = _("PNG images");
- filters += wxT("|*.png");
+ filters += "|*.png";
}
wxFileDialog *dlg = new wxFileDialog(
@@ -286,7 +280,7 @@ void SpekWindow::on_save(wxCommandEvent&)
wxFileName file_name(this->path);
name = file_name.GetFullName();
}
- name += wxT(".png");
+ name += ".png";
dlg->SetFilename(name);
if (dlg->ShowModal() == wxID_OK) {
@@ -311,34 +305,34 @@ void SpekWindow::on_preferences(wxCommandEvent&)
void SpekWindow::on_help(wxCommandEvent&)
{
wxLaunchDefaultBrowser(
- wxString::Format(wxT("http://spek.cc/man-%s.html"), wxT(PACKAGE_VERSION))
+ wxString::Format("http://spek.cc/man-%s.html", PACKAGE_VERSION)
);
}
void SpekWindow::on_about(wxCommandEvent&)
{
wxAboutDialogInfo info;
- info.AddDeveloper(wxT("Alexander Kojevnikov"));
- info.AddDeveloper(wxT("Colin Watson"));
- info.AddDeveloper(wxT("Daniel Hams"));
- info.AddDeveloper(wxT("Fabian Deutsch"));
- info.AddDeveloper(wxT("Jonathan Gonzalez V"));
- info.AddDeveloper(wxT("Simon Ruderich"));
- info.AddDeveloper(wxT("Stefan Kost"));
- info.AddDeveloper(wxT("Thibault North"));
- info.AddArtist(wxT("Olga Vasylevska"));
+ info.AddDeveloper("Alexander Kojevnikov");
+ info.AddDeveloper("Colin Watson");
+ info.AddDeveloper("Daniel Hams");
+ info.AddDeveloper("Fabian Deutsch");
+ info.AddDeveloper("Jonathan Gonzalez V");
+ info.AddDeveloper("Simon Ruderich");
+ info.AddDeveloper("Stefan Kost");
+ info.AddDeveloper("Thibault North");
+ info.AddArtist("Olga Vasylevska");
// TRANSLATORS: Add your name here
wxString translator = _("translator-credits");
- if (translator != wxT("translator-credits")) {
+ if (translator != "translator-credits") {
info.AddTranslator(translator);
}
- info.SetName(wxT("Spek"));
- info.SetVersion(wxT(PACKAGE_VERSION));
+ info.SetName("Spek");
+ info.SetVersion(PACKAGE_VERSION);
info.SetCopyright(_("Copyright (c) 2010-2013 Alexander Kojevnikov and contributors"));
info.SetDescription(this->description);
#ifdef OS_UNIX
- info.SetWebSite(wxT("http://spek.cc/"), _("Spek Website"));
- info.SetIcon(wxArtProvider::GetIcon(wxT("spek"), wxART_OTHER, wxSize(128, 128)));
+ info.SetWebSite("http://spek.cc/", _("Spek Website"));
+ info.SetIcon(wxArtProvider::GetIcon("spek", wxART_OTHER, wxSize(128, 128)));
#endif
wxAboutBox(info);
}
@@ -351,7 +345,7 @@ void SpekWindow::on_notify(wxCommandEvent&)
void SpekWindow::on_visit(wxCommandEvent&)
{
- wxLaunchDefaultBrowser(wxT("http://spek.cc"));
+ wxLaunchDefaultBrowser("http://spek.cc");
}
void SpekWindow::on_close(wxCommandEvent& event)
@@ -387,8 +381,8 @@ static void * check_version(void *p)
// Get the version number.
wxString version;
wxHTTP http;
- if (http.Connect(wxT("spek.cc"))) {
- wxInputStream *stream = http.GetInputStream(wxT("/version"));
+ if (http.Connect("spek.cc")) {
+ wxInputStream *stream = http.GetInputStream("/version");
if (stream) {
wxStringOutputStream out(&version);
stream->Read(out);
diff --git a/src/spek.cc b/src/spek.cc
@@ -57,29 +57,27 @@ bool Spek::OnInit()
static const wxCmdLineEntryDesc desc[] = {{
wxCMD_LINE_SWITCH,
- wxT_2("h"),
- wxT_2("help"),
- wxT_2("Show this help message"),
+ "h",
+ "help",
+ "Show this help message",
wxCMD_LINE_VAL_NONE,
- wxCMD_LINE_OPTION_HELP
+ wxCMD_LINE_OPTION_HELP,
}, {
wxCMD_LINE_SWITCH,
- wxT_2("V"),
- wxT_2("version"),
- wxT_2("Display the version and exit"),
+ "V",
+ "version",
+ "Display the version and exit",
wxCMD_LINE_VAL_NONE,
- wxCMD_LINE_PARAM_OPTIONAL
+ wxCMD_LINE_PARAM_OPTIONAL,
}, {
wxCMD_LINE_PARAM,
NULL,
NULL,
- wxT_2("FILE"),
+ "FILE",
wxCMD_LINE_VAL_STRING,
- wxCMD_LINE_PARAM_OPTIONAL
- }, {
- // TODO: use wxCMD_LINE_DESC_END after settling on wx29.
- wxCMD_LINE_NONE, NULL, NULL, NULL, wxCMD_LINE_VAL_NONE, 0
- }
+ wxCMD_LINE_PARAM_OPTIONAL,
+ },
+ wxCMD_LINE_DESC_END,
};
wxCmdLineParser parser(desc, argc, argv);
@@ -91,10 +89,10 @@ bool Spek::OnInit()
this->quit = true;
return true;
}
- if (parser.Found(wxT("version"))) {
+ if (parser.Found("version")) {
// TRANSLATORS: the %s is the package version.
- wxPrintf(_("Spek version %s"), wxT(PACKAGE_VERSION));
- wxPrintf(wxT("\n"));
+ wxPrintf(_("Spek version %s"), PACKAGE_VERSION);
+ wxPrintf("\n");
this->quit = true;
return true;
}