summaryrefslogtreecommitdiff
path: root/plugingui
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-02-17 15:00:52 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-02-17 15:30:16 +0100
commit4363187d4e86c63d9465cbe7296d11fdc7815e32 (patch)
tree33005bd8183d74825b44bc4d47680faf7df009f0 /plugingui
parent70e08d1325b2cdd0e9c16a193cc6ed10d2d21617 (diff)
Replace obsolete WIN32 ifdefs with platform define.
Diffstat (limited to 'plugingui')
-rw-r--r--plugingui/Makefile.mingw322
-rw-r--r--plugingui/directory.cc22
-rw-r--r--plugingui/filebrowser.cc7
-rw-r--r--plugingui/filebrowser.h6
-rw-r--r--plugingui/testmain.cc2
-rw-r--r--plugingui/tests/resizetest.cc2
-rw-r--r--plugingui/tests/tabwidgettest.cc2
-rw-r--r--plugingui/window.cc35
8 files changed, 42 insertions, 36 deletions
diff --git a/plugingui/Makefile.mingw32 b/plugingui/Makefile.mingw32
index 50c8fad..7f5b191 100644
--- a/plugingui/Makefile.mingw32
+++ b/plugingui/Makefile.mingw32
@@ -49,7 +49,7 @@ GUI_SRC = \
resource_data.cc \
lodepng/lodepng.cpp
-GUI_CFLAGS=-DUSE_THREAD -DWIN32 -DSTANDALONE
+GUI_CFLAGS=-DUSE_THREAD -DUI_WIN32 -DSTANDALONE
GUI_LIBS=-lgdi32 -lsetupapi -lws2_32
DBG_SRC = \
diff --git a/plugingui/directory.cc b/plugingui/directory.cc
index 7515c30..96ed5b7 100644
--- a/plugingui/directory.cc
+++ b/plugingui/directory.cc
@@ -33,7 +33,9 @@
#include <vector>
#include <string.h>
-#ifdef WIN32
+#include <platform.h>
+
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
#include <direct.h>
#include <windows.h>
#endif
@@ -43,7 +45,7 @@
#define DRUMKIT_SUFFIX ".xml"
// http://en.wikipedia.org/wiki/Path_(computing)
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
#define SEP "\\"
#else
#define SEP "/"
@@ -216,7 +218,7 @@ Directory::EntryList Directory::listFiles(std::string path, unsigned char filter
}
}
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
//DEBUG(directory, "Root is %s\n", Directory::root(path).c_str());
//DEBUG(directory, "Current path %s is root? %d", path.c_str(),
// Directory::isRoot(path));
@@ -270,7 +272,7 @@ Directory::EntryList Directory::listFiles(std::string path, unsigned char filter
bool Directory::isRoot(std::string path)
{
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
std::transform(path.begin(), path.end(), path.begin(), ::tolower);
std::string root_str = Directory::root(path);
std::transform(root_str.begin(), root_str.end(), root_str.begin(), ::tolower);
@@ -321,7 +323,7 @@ std::string Directory::root()
std::string Directory::root(std::string path)
{
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
if(path.size() < 2)
{
return "c:"; // just something default when input is bad
@@ -338,7 +340,7 @@ std::string Directory::root(std::string path)
Directory::DriveList Directory::drives()
{
Directory::DriveList drives;
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
unsigned int d = GetLogicalDrives();
for(int i = 0; i < 32; ++i)
{
@@ -399,7 +401,7 @@ bool Directory::exists(std::string path)
bool Directory::isHidden(std::string path)
{
//DEBUG(directory, "Is '%s' hidden?\n", path.c_str());
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
// We dont want to filter out '..' pointing to root of a partition
unsigned pos = path.find_last_of("/\\");
std::string entry = path.substr(pos+1);
@@ -518,7 +520,7 @@ std::string Directory::pathToStr(Directory::Path& path)
{
std::string dir = *it;
//DEBUG(directory, "\tDir '%s'\n", dir.c_str());
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
if(it != path.begin())
{
cleaned_path += SEP;
@@ -534,12 +536,12 @@ std::string Directory::pathToStr(Directory::Path& path)
if(cleaned_path.empty())
{
cleaned_path = Directory::root();
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
cleaned_path += SEP;
#endif
}
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
if(cleaned_path.size() == 2)
{
cleaned_path += SEP;
diff --git a/plugingui/filebrowser.cc b/plugingui/filebrowser.cc
index 329c599..6ac9d3e 100644
--- a/plugingui/filebrowser.cc
+++ b/plugingui/filebrowser.cc
@@ -39,6 +39,7 @@
#include <sys/stat.h>
#include <unistd.h>
+#include <platform.h>
#include <hugin.hpp>
#ifdef __MINGW32__
@@ -57,7 +58,7 @@ FileBrowser::FileBrowser(Widget *parent)
, btn_esc(this)
, back(":bg.png")
{
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
above_root = false;
#endif
@@ -185,7 +186,7 @@ void FileBrowser::changeDir()
INFO(filebrowser, "Changing path to '%s'\n",
(dir.path() + dir.seperator() + value).c_str());
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
if(above_root && !value.empty())
{
dir.setPath(value + dir.seperator());
@@ -211,7 +212,7 @@ void FileBrowser::changeDir()
std::vector<ListBoxBasic::Item> items;
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
if(Directory::isRoot(dir.path()) && (value == ".."))
{
DEBUG(filebrowser, "Showing partitions...\n");
diff --git a/plugingui/filebrowser.h b/plugingui/filebrowser.h
index 64ef4da..bc7170a 100644
--- a/plugingui/filebrowser.h
+++ b/plugingui/filebrowser.h
@@ -27,6 +27,7 @@
#pragma once
#include <notifier.h>
+#include <platform.h>
#include "widget.h"
#include "button.h"
@@ -36,7 +37,8 @@
#include "image.h"
#include "directory.h"
-namespace GUI {
+namespace GUI
+{
class FileBrowser : public Widget {
public:
@@ -59,7 +61,7 @@ private:
void handleKeyEvent();
Directory dir;
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
bool above_root;
bool in_root;
#endif
diff --git a/plugingui/testmain.cc b/plugingui/testmain.cc
index 8edfd0a..b1697eb 100644
--- a/plugingui/testmain.cc
+++ b/plugingui/testmain.cc
@@ -48,7 +48,7 @@ int main()
while(main_window.processEvents())
{
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
SleepEx(50, FALSE);
#else
usleep(50000);
diff --git a/plugingui/tests/resizetest.cc b/plugingui/tests/resizetest.cc
index 2267030..f5ba01b 100644
--- a/plugingui/tests/resizetest.cc
+++ b/plugingui/tests/resizetest.cc
@@ -135,7 +135,7 @@ int main()
while(test_window.processEvents())
{
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
SleepEx(50, FALSE);
#else
usleep(50000);
diff --git a/plugingui/tests/tabwidgettest.cc b/plugingui/tests/tabwidgettest.cc
index e187fee..ca24040 100644
--- a/plugingui/tests/tabwidgettest.cc
+++ b/plugingui/tests/tabwidgettest.cc
@@ -155,7 +155,7 @@ int main()
while(test_window.processEvents())
{
-#ifdef WIN32
+#if DG_PLATFORM == DG_PLATFORM_WINDOWS
SleepEx(50, FALSE);
#else
usleep(50000);
diff --git a/plugingui/window.cc b/plugingui/window.cc
index e2a5b58..d4046c2 100644
--- a/plugingui/window.cc
+++ b/plugingui/window.cc
@@ -30,19 +30,19 @@
#include "painter.h"
-#ifndef PUGL
-#ifdef X11
+#ifndef UI_PUGL
+#ifdef UI_X11
#include "nativewindow_x11.h"
-#endif/*X11*/
-#ifdef WIN32
+#endif // UI_X11
+#ifdef UI_WIN32
#include "nativewindow_win32.h"
-#endif/*WIN32*/
-#ifdef COCOA
+#endif // UI_WIN32
+#ifdef UI_COCOA
#include "nativewindow_cocoa.h"
-#endif/*COCOA*/
+#endif // UI_COCOA
#else
#include "nativewindow_pugl.h"
-#endif
+#endif // !UI_PUGL
namespace GUI
{
@@ -55,19 +55,20 @@ Window::Window(void* native_window)
_width = wpixbuf.width;
_height = wpixbuf.height;
-#ifndef PUGL
-#ifdef X11
+#ifndef UI_PUGL
+#ifdef UI_X11
native = new NativeWindowX11(native_window, *this);
-#endif/*X11*/
-#ifdef WIN32
+#endif // UI_X11
+#ifdef UI_WIN32
native = new NativeWindowWin32(native_window, *this);
-#endif/*WIN32*/
-#ifdef COCOA
+#endif // UI_WIN32
+#ifdef UI_COCOA
native = new NativeWindowCocoa(native_window, *this);
-#endif/*COCOA*/
-#else/*Use pugl*/
+#endif // UI_COCOA
+#else
+ // Use pugl
native = new NativeWindowPugl(native_window, *this);
-#endif
+#endif // !UI_PUGL
eventhandler = new EventHandler(*native, *this);
}