commit 98ba100f0ce41fbf8547a8eb3eecdc0859ba6928
parent f408c5584ff50d6720e8a7f3f542988c0f0b3d3d
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date: Sun, 5 Aug 2012 22:36:19 -0700
Add spek-platform.cc
Diffstat:
4 files changed, 48 insertions(+), 25 deletions(-)
diff --git a/src/Makefile.am b/src/Makefile.am
@@ -4,6 +4,8 @@ spek_SOURCES = \
spek.cc \
spek-fft.c \
spek-fft.h \
+ spek-platform.cc \
+ spek-platform.h \
spek-window.cc \
spek-window.hh
diff --git a/src/spek-fft.h b/src/spek-fft.h
@@ -16,8 +16,8 @@
* along with Spek. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef SPEK_FFT_H__
-#define SPEK_FFT_H__
+#ifndef SPEK_FFT_H_
+#define SPEK_FFT_H_
#ifdef __cplusplus
extern "C" {
diff --git a/src/spek-platform.cc b/src/spek-platform.cc
@@ -0,0 +1,33 @@
+/* spek-platform.cc
+ *
+ * Copyright (C) 2010-2012 Alexander Kojevnikov <alexander@kojevnikov.com>
+ *
+ * Spek is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Spek is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Spek. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <cstring>
+
+#include <wx/filename.h>
+
+#include "spek-platform.h"
+
+char * spek_platform_short_path(const char *path)
+{
+#ifdef OS_WIN
+ wxFileName file_name(wxString(path, wxConvUTF8));
+ return strdup(file_name.GetShortPath().char_str(wxConvFile));
+#endif
+ return NULL;
+}
+
diff --git a/src/spek-platform.h b/src/spek-platform.h
@@ -1,6 +1,6 @@
/* spek-platform.h
*
- * Copyright (C) 2010,2011 Alexander Kojevnikov <alexander@kojevnikov.com>
+ * Copyright (C) 2010-2012 Alexander Kojevnikov <alexander@kojevnikov.com>
*
* Spek is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,30 +16,18 @@
* along with Spek. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef __SPEK_PLATFORM_H__
-#define __SPEK_PLATFORM_H__
+#ifndef SPEK_PLATFORM_H_
+#define SPEK_PLATFORM_H_
-#include <gtk/gtk.h>
-
-/* Platform-specific initialisation */
-void spek_platform_init ();
-
-/* Convert from UTF-16 to UTF-8 when running on Windows */
-void spek_platform_fix_args (gchar **argv, gint argc);
-
-/* OSX has its own approach to menus and accelerators */
-void spek_platform_fix_ui (GtkUIManager *ui);
-
-/* Platform-specific locale directory */
-gchar *spek_platform_locale_dir ();
-
-/* Open a link in the browser */
-void spek_platform_show_uri (const gchar *uri);
+#ifdef __cplusplus
+extern "C" {
+#endif
-/* Read a line from a uri */
-gchar *spek_platform_read_line (const gchar *uri);
+// Returns a 8.3 version of the UTF8-encoded path on Windows and NULL on other platforms.
+char * spek_platform_short_path (const char *path);
-/* Fonts are smaller on OS X */
-gdouble spek_platform_get_font_scale ();
+#ifdef __cplusplus
+}
+#endif
#endif