This commit is contained in:
Alexander Kojevnikov 2012-09-03 10:53:25 -07:00
parent 98fd7c5be3
commit e22440a32f
5 changed files with 19 additions and 23 deletions

View File

@ -28,7 +28,7 @@
#include "spek-platform.hh"
void SpekPlatform::init()
void spek_platform_init()
{
#ifdef OS_OSX
ProcessSerialNumber PSN;
@ -37,7 +37,7 @@ void SpekPlatform::init()
#endif
}
wxString SpekPlatform::config_path(const wxString& app_name)
wxString spek_platform_config_path(const wxString& app_name)
{
#ifdef OS_WIN
wxFileName file_name(wxStandardPaths::Get().GetUserConfigDir(), wxEmptyString);
@ -51,7 +51,7 @@ wxString SpekPlatform::config_path(const wxString& app_name)
return file_name.GetFullPath();
}
bool SpekPlatform::can_change_language()
bool spek_platform_can_change_language()
{
#ifdef OS_UNIX
return false;
@ -60,7 +60,7 @@ bool SpekPlatform::can_change_language()
#endif
}
double SpekPlatform::font_scale()
double spek_platform_font_scale()
{
#ifdef OS_OSX
return 1.3;

View File

@ -21,21 +21,17 @@
#include <wx/string.h>
class SpekPlatform
{
public:
// Platform-specific initialisation code.
static void init();
// Platform-specific initialisation code.
void spek_platform_init();
// Not quite XDG-compatible, but close enough.
static wxString config_path(const wxString& app_name);
// Not quite XDG-compatible, but close enough.
wxString spek_platform_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 can_change_language();
// 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.
bool spek_platform_can_change_language();
// Fonts are smaller on OSX.
static double font_scale();
};
// Fonts are smaller on OSX.
double spek_platform_font_scale();
#endif

View File

@ -49,7 +49,7 @@ void SpekPreferences::init()
SpekPreferences::SpekPreferences() : locale(NULL)
{
wxString path = SpekPlatform::config_path(wxT("spek"));
wxString path = spek_platform_config_path(wxT("spek"));
this->config = new wxFileConfig(
wxEmptyString,
wxEmptyString,

View File

@ -173,16 +173,16 @@ void SpekSpectrogram::render(wxDC& dc)
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetTextForeground(wxColour(255, 255, 255));
wxFont normal_font = wxFont(
(int)round(9 * SpekPlatform::font_scale()),
(int)round(9 * spek_platform_font_scale()),
wxFONTFAMILY_SWISS,
wxFONTSTYLE_NORMAL,
wxFONTWEIGHT_NORMAL
);
wxFont large_font = wxFont(normal_font);
large_font.SetPointSize((int)round(10 * SpekPlatform::font_scale()));
large_font.SetPointSize((int)round(10 * spek_platform_font_scale()));
large_font.SetWeight(wxFONTWEIGHT_BOLD);
wxFont small_font = wxFont(normal_font);
small_font.SetPointSize((int)round(8 * SpekPlatform::font_scale()));
small_font.SetPointSize((int)round(8 * spek_platform_font_scale()));
dc.SetFont(normal_font);
int normal_height = dc.GetTextExtent(wxT("dummy")).GetHeight();
dc.SetFont(large_font);

View File

@ -50,9 +50,9 @@ bool Spek::OnInit()
wxInitAllImageHandlers();
wxSocketBase::Initialize();
SpekPlatform::init();
SpekPreferences::get().init();
spek_audio_init();
spek_platform_init();
SpekPreferences::get().init();
static const wxCmdLineEntryDesc desc[] = {{
wxCMD_LINE_SWITCH,