spek-platform.cc (1015B)
1 #include <cstring> 2 3 #ifdef OS_OSX 4 #include <ApplicationServices/ApplicationServices.h> 5 #endif 6 7 #include <wx/filename.h> 8 #include <wx/stdpaths.h> 9 #include <wx/utils.h> 10 11 #include "spek-platform.h" 12 13 void spek_platform_init() 14 { 15 #ifdef OS_OSX 16 ProcessSerialNumber PSN; 17 GetCurrentProcess(&PSN); 18 TransformProcessType(&PSN, kProcessTransformToForegroundApplication); 19 #endif 20 } 21 22 wxString spek_platform_config_path(const wxString& app_name) 23 { 24 #ifdef OS_WIN 25 wxFileName file_name(wxStandardPaths::Get().GetUserConfigDir(), wxEmptyString); 26 #else 27 wxFileName file_name(wxGetHomeDir(), wxEmptyString); 28 file_name.AppendDir(".config"); 29 #endif 30 file_name.AppendDir(app_name); 31 file_name.Mkdir(0755, wxPATH_MKDIR_FULL); 32 file_name.SetFullName("preferences"); 33 return file_name.GetFullPath(); 34 } 35 36 bool spek_platform_can_change_language() 37 { 38 #ifdef OS_UNIX 39 return false; 40 #else 41 return true; 42 #endif 43 } 44 45 double spek_platform_font_scale() 46 { 47 #ifdef OS_OSX 48 return 1.3; 49 #else 50 return 1.0; 51 #endif 52 }