diff --git a/.travis/install.sh b/.travis/install.sh
index f9897173..71d51529 100755
--- a/.travis/install.sh
+++ b/.travis/install.sh
@@ -5,6 +5,7 @@ set -e
sudo apt-get install -y \
g++ \
pkg-config \
+ libcairo2-dev \
libjack-jackd2-dev \
liblo-dev \
libgl1-mesa-dev \
diff --git a/.travis/script-linux.sh b/.travis/script-linux.sh
index 36135d72..7d6a524b 100755
--- a/.travis/script-linux.sh
+++ b/.travis/script-linux.sh
@@ -7,8 +7,14 @@ _FLAGS="-Werror"
export CFLAGS="${_FLAGS}"
export CXXFLAGS="${_FLAGS}"
-# Start clean
+echo "==============> Normal build"
make clean >/dev/null
-
-# Build now
make
+
+echo "==============> No namespace build"
+make clean >/dev/null
+make CXXFLAGS="${_FLAGS} -DDONT_SET_USING_DISTRHO_NAMESPACE -DDONT_SET_USING_DGL_NAMESPACE"
+
+echo "==============> Custom namespace build"
+make clean >/dev/null
+make CXXFLAGS="${_FLAGS} -DDISTRHO_NAMESPACE=WubbWubb -DDGL_NAMESPACE=DabDab"
diff --git a/.travis/script-win32.sh b/.travis/script-win32.sh
index a1abf3b2..f9b9af94 100755
--- a/.travis/script-win32.sh
+++ b/.travis/script-win32.sh
@@ -17,4 +17,4 @@ export CROSS_COMPILING=true
make clean >/dev/null
# Build now
-make
+make HAVE_CAIRO=false HAVE_JACK=false
diff --git a/.travis/script-win64.sh b/.travis/script-win64.sh
index ae3ec1b6..a49ba912 100755
--- a/.travis/script-win64.sh
+++ b/.travis/script-win64.sh
@@ -17,4 +17,4 @@ export CROSS_COMPILING=true
make clean >/dev/null
# Build now
-make
+make HAVE_CAIRO=false HAVE_JACK=false
diff --git a/Makefile.base.mk b/Makefile.base.mk
index 6c7d17aa..5496a6ea 100644
--- a/Makefile.base.mk
+++ b/Makefile.base.mk
@@ -11,6 +11,8 @@ CXX ?= g++
# ---------------------------------------------------------------------------------------------------------------------
# Auto-detect OS if not defined
+TARGET_MACHINE := $(shell $(CC) -dumpmachine)
+
ifneq ($(BSD),true)
ifneq ($(HAIKU),true)
ifneq ($(HURD),true)
@@ -18,7 +20,6 @@ ifneq ($(LINUX),true)
ifneq ($(MACOS),true)
ifneq ($(WINDOWS),true)
-TARGET_MACHINE := $(shell $(CC) -dumpmachine)
ifneq (,$(findstring bsd,$(TARGET_MACHINE)))
BSD=true
endif
@@ -45,6 +46,28 @@ endif
endif
endif
+# ---------------------------------------------------------------------------------------------------------------------
+# Auto-detect the processor
+
+TARGET_PROCESSOR := $(firstword $(subst -, ,$(TARGET_MACHINE)))
+
+ifneq (,$(filter i%86,$(TARGET_PROCESSOR)))
+CPU_I386=true
+CPU_I386_OR_X86_64=true
+endif
+ifneq (,$(filter x86_64,$(TARGET_PROCESSOR)))
+CPU_X86_64=true
+CPU_I386_OR_X86_64=true
+endif
+ifneq (,$(filter arm%,$(TARGET_PROCESSOR)))
+CPU_ARM=true
+CPU_ARM_OR_AARCH64=true
+endif
+ifneq (,$(filter aarch64%,$(TARGET_PROCESSOR)))
+CPU_AARCH64=true
+CPU_ARM_OR_AARCH64=true
+endif
+
# ---------------------------------------------------------------------------------------------------------------------
# Set PKG_CONFIG (can be overridden by environment variable)
@@ -106,7 +129,15 @@ endif
# Set build and link flags
BASE_FLAGS = -Wall -Wextra -pipe -MD -MP
-BASE_OPTS = -O3 -ffast-math -mtune=generic -msse -msse2 -fdata-sections -ffunction-sections
+BASE_OPTS = -O3 -ffast-math -mtune=generic -fdata-sections -ffunction-sections
+
+ifeq ($(CPU_I386_OR_X86_64),true)
+BASE_OPTS += -msse -msse2
+endif
+
+ifeq ($(CPU_ARM),true)
+BASE_OPTS += -mfpu=neon-vfpv4 -mfloat-abi=hard
+endif
ifeq ($(MACOS),true)
# MacOS linker flags
@@ -208,18 +239,22 @@ HAVE_LIBLO = $(shell $(PKG_CONFIG) --exists liblo && echo true)
# ---------------------------------------------------------------------------------------------------------------------
# Set Generic DGL stuff
+ifeq ($(HAIKU),true)
+DGL_SYSTEM_LIBS += -lbe
+endif
+
ifeq ($(MACOS),true)
-DGL_SYSTEM_LIBS += -framework Cocoa
+DGL_SYSTEM_LIBS += -framework Cocoa
endif
ifeq ($(WINDOWS),true)
-DGL_SYSTEM_LIBS += -lgdi32 -lcomdlg32
+DGL_SYSTEM_LIBS += -lgdi32 -lcomdlg32
endif
ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true)
ifeq ($(HAVE_X11),true)
-DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags x11)
-DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs x11)
+DGL_FLAGS += $(shell $(PKG_CONFIG) --cflags x11)
+DGL_SYSTEM_LIBS += $(shell $(PKG_CONFIG) --libs x11)
endif
endif
@@ -244,6 +279,11 @@ ifeq ($(HAVE_OPENGL),true)
DGL_FLAGS += -DHAVE_OPENGL
+ifeq ($(HAIKU),true)
+OPENGL_FLAGS = $(shell $(PKG_CONFIG) --cflags gl)
+OPENGL_LIBS = $(shell $(PKG_CONFIG) --libs gl)
+endif
+
ifeq ($(MACOS),true)
OPENGL_LIBS = -framework OpenGL
endif
@@ -252,7 +292,7 @@ ifeq ($(WINDOWS),true)
OPENGL_LIBS = -lopengl32
endif
-ifneq ($(MACOS_OR_WINDOWS),true)
+ifneq ($(HAIKU_OR_MACOS_OR_WINDOWS),true)
OPENGL_FLAGS = $(shell $(PKG_CONFIG) --cflags gl x11)
OPENGL_LIBS = $(shell $(PKG_CONFIG) --libs gl x11)
endif
@@ -291,3 +331,12 @@ SHARED = -shared
endif
# ---------------------------------------------------------------------------------------------------------------------
+# Handle the verbosity switch
+
+ifeq ($(VERBOSE),true)
+SILENT =
+else
+SILENT = @
+endif
+
+# ---------------------------------------------------------------------------------------------------------------------
diff --git a/Makefile.plugins.mk b/Makefile.plugins.mk
index 4afe6b40..7c1e5540 100644
--- a/Makefile.plugins.mk
+++ b/Makefile.plugins.mk
@@ -70,8 +70,9 @@ UI_TYPE = opengl
endif
ifeq ($(UI_TYPE),cairo)
+DGL_FLAGS += -DDGL_CAIRO
ifeq ($(HAVE_CAIRO),true)
-DGL_FLAGS += $(CAIRO_FLAGS) -DDGL_CAIRO
+DGL_FLAGS += $(CAIRO_FLAGS)
DGL_LIBS += $(CAIRO_LIBS)
DGL_LIB = $(DPF_PATH)/build/libdgl-cairo.a
HAVE_DGL = true
@@ -81,8 +82,9 @@ endif
endif
ifeq ($(UI_TYPE),opengl)
+DGL_FLAGS += -DDGL_OPENGL
ifeq ($(HAVE_OPENGL),true)
-DGL_FLAGS += $(OPENGL_FLAGS) -DDGL_OPENGL
+DGL_FLAGS += $(OPENGL_FLAGS)
DGL_LIBS += $(OPENGL_LIBS)
DGL_LIB = $(DPF_PATH)/build/libdgl-opengl.a
HAVE_DGL = true
@@ -91,6 +93,11 @@ HAVE_DGL = false
endif
endif
+ifeq ($(UI_TYPE),external)
+DGL_FLAGS += -DDGL_EXTERNAL
+HAVE_DGL = true
+endif
+
DGL_LIBS += $(DGL_SYSTEM_LIBS)
ifneq ($(HAVE_DGL),true)
@@ -114,17 +121,17 @@ all:
$(BUILD_DIR)/%.c.o: %.c
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
@echo "Compiling $<"
- @$(CC) $< $(BUILD_C_FLAGS) -c -o $@
+ $(SILENT)$(CC) $< $(BUILD_C_FLAGS) -c -o $@
$(BUILD_DIR)/%.cc.o: %.cc
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
@echo "Compiling $<"
- @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
$(BUILD_DIR)/%.cpp.o: %.cpp
-@mkdir -p "$(shell dirname $(BUILD_DIR)/$<)"
@echo "Compiling $<"
- @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
clean:
rm -rf $(BUILD_DIR)
@@ -135,22 +142,22 @@ clean:
$(BUILD_DIR)/DistrhoPluginMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
-@mkdir -p $(BUILD_DIR)
@echo "Compiling DistrhoPluginMain.cpp ($*)"
- @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
$(BUILD_DIR)/DistrhoUIMain_%.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
-@mkdir -p $(BUILD_DIR)
@echo "Compiling DistrhoUIMain.cpp ($*)"
- @$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -DDISTRHO_PLUGIN_TARGET_$* -c -o $@
$(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o: $(DPF_PATH)/distrho/DistrhoPluginMain.cpp
-@mkdir -p $(BUILD_DIR)
@echo "Compiling DistrhoPluginMain.cpp (JACK)"
- @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell $(PKG_CONFIG) --cflags jack) -DDISTRHO_PLUGIN_TARGET_JACK -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(shell $(PKG_CONFIG) --cflags jack) -DDISTRHO_PLUGIN_TARGET_JACK -c -o $@
$(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o: $(DPF_PATH)/distrho/DistrhoUIMain.cpp
-@mkdir -p $(BUILD_DIR)
@echo "Compiling DistrhoUIMain.cpp (DSSI)"
- @$(CXX) $< $(BUILD_CXX_FLAGS) $(shell $(PKG_CONFIG) --cflags liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(shell $(PKG_CONFIG) --cflags liblo) -DDISTRHO_PLUGIN_TARGET_DSSI -c -o $@
# ---------------------------------------------------------------------------------------------------------------------
# JACK
@@ -164,7 +171,7 @@ $(jack): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_JACK.cpp.o
endif
-@mkdir -p $(shell dirname $@)
@echo "Creating JACK standalone for $(NAME)"
- @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell $(PKG_CONFIG) --libs jack) -o $@
+ $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell $(PKG_CONFIG) --libs jack) -o $@
# ---------------------------------------------------------------------------------------------------------------------
# LADSPA
@@ -174,7 +181,7 @@ ladspa: $(ladspa_dsp)
$(ladspa_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LADSPA.cpp.o
-@mkdir -p $(shell dirname $@)
@echo "Creating LADSPA plugin for $(NAME)"
- @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
+ $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
# ---------------------------------------------------------------------------------------------------------------------
# DSSI
@@ -186,12 +193,12 @@ dssi_ui: $(dssi_ui)
$(dssi_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_DSSI.cpp.o
-@mkdir -p $(shell dirname $@)
@echo "Creating DSSI plugin library for $(NAME)"
- @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
+ $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
$(dssi_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_DSSI.cpp.o $(DGL_LIB)
-@mkdir -p $(shell dirname $@)
@echo "Creating DSSI UI for $(NAME)"
- @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell $(PKG_CONFIG) --libs liblo) -o $@
+ $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(shell $(PKG_CONFIG) --libs liblo) -o $@
# ---------------------------------------------------------------------------------------------------------------------
# LV2
@@ -203,17 +210,17 @@ lv2_sep: $(lv2_dsp) $(lv2_ui)
$(lv2): $(OBJS_DSP) $(OBJS_UI) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
-@mkdir -p $(shell dirname $@)
@echo "Creating LV2 plugin for $(NAME)"
- @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
+ $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
$(lv2_dsp): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_LV2.cpp.o
-@mkdir -p $(shell dirname $@)
@echo "Creating LV2 plugin library for $(NAME)"
- @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
+ $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(SHARED) -o $@
$(lv2_ui): $(OBJS_UI) $(BUILD_DIR)/DistrhoUIMain_LV2.cpp.o $(DGL_LIB)
-@mkdir -p $(shell dirname $@)
@echo "Creating LV2 plugin UI for $(NAME)"
- @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
+ $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
# ---------------------------------------------------------------------------------------------------------------------
# VST
@@ -227,7 +234,7 @@ $(vst): $(OBJS_DSP) $(BUILD_DIR)/DistrhoPluginMain_VST.cpp.o
endif
-@mkdir -p $(shell dirname $@)
@echo "Creating VST plugin for $(NAME)"
- @$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
+ $(SILENT)$(CXX) $^ $(BUILD_CXX_FLAGS) $(LINK_FLAGS) $(DGL_LIBS) $(SHARED) -o $@
# ---------------------------------------------------------------------------------------------------------------------
diff --git a/README.md b/README.md
index 2df2ea84..a2c63dfa 100644
--- a/README.md
+++ b/README.md
@@ -36,6 +36,7 @@ List of plugins made with DPF:
- [Rezonateur](https://github.com/jpcima/rezonateur)
- [QuadraFuzz](https://github.com/jpcima/quadrafuzz)
- [Stone Phaser](https://github.com/jpcima/stone-phaser)
+ - [Uhhyou Plugins](https://github.com/ryukau/LV2Plugins)
- [Shiru Plugins](https://github.com/linuxmao-org/shiru-plugins) (work in progress)
- [midiomatic](https://github.com/SpotlightKid/midiomatic) (work in progress)
- [osamc-lv2-workshop](https://github.com/osamc-lv2-workshop/lv2-workshop) (simple plugins code examples)
diff --git a/dgl/ImageWidgets.hpp b/dgl/ImageWidgets.hpp
index 0e1e1ddd..ac8a3abb 100644
--- a/dgl/ImageWidgets.hpp
+++ b/dgl/ImageWidgets.hpp
@@ -25,8 +25,13 @@ START_NAMESPACE_DGL
// -----------------------------------------------------------------------
+#ifndef DISTRHO_OS_HAIKU
class ImageAboutWindow : public Window,
public Widget
+#else
+// crash when creating or opening 2nd window
+class ImageAboutWindow
+#endif
{
public:
explicit ImageAboutWindow(Window& parent, const Image& image = Image());
@@ -34,11 +39,15 @@ public:
void setImage(const Image& image);
+#ifndef DISTRHO_OS_HAIKU
protected:
void onDisplay() override;
bool onKeyboard(const KeyboardEvent&) override;
bool onMouse(const MouseEvent&) override;
void onReshape(uint width, uint height) override;
+#else
+ void exec() {}
+#endif
private:
Image fImgBackground;
diff --git a/dgl/Makefile b/dgl/Makefile
index 3005e709..20bd79e3 100644
--- a/dgl/Makefile
+++ b/dgl/Makefile
@@ -77,65 +77,65 @@ all: $(TARGETS)
../build/libdgl-cairo.a: $(OBJS_cairo)
-@mkdir -p ../build
@echo "Creating libdgl-cairo.a"
- @rm -f $@
- @$(AR) crs $@ $^
+ $(SILENT)rm -f $@
+ $(SILENT)$(AR) crs $@ $^
../build/libdgl-opengl.a: $(OBJS_opengl)
-@mkdir -p ../build
@echo "Creating libdgl-opengl.a"
- @rm -f $@
- @$(AR) crs $@ $^
+ $(SILENT)rm -f $@
+ $(SILENT)$(AR) crs $@ $^
# Compat name, to be removed soon
../build/libdgl.a: ../build/libdgl-opengl.a
@echo "Symlinking libdgl.a"
- @ln -sf $< $@
+ $(SILENT)ln -sf $< $@
# ---------------------------------------------------------------------------------------------------------------------
../build/dgl/%.c.o: src/%.c
-@mkdir -p ../build/dgl
@echo "Compiling $<"
- @$(CC) $< $(BUILD_C_FLAGS) -c -o $@
+ $(SILENT)$(CC) $< $(BUILD_C_FLAGS) -c -o $@
../build/dgl/%.cpp.o: src/%.cpp
-@mkdir -p ../build/dgl
@echo "Compiling $<"
- @$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@
# ---------------------------------------------------------------------------------------------------------------------
../build/dgl/%.cpp.cairo.o: src/%.cpp
-@mkdir -p ../build/dgl
@echo "Compiling $< (Cairo variant)"
- @$(CXX) $< $(BUILD_CXX_FLAGS) $(CAIRO_FLAGS) -DDGL_CAIRO -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(CAIRO_FLAGS) -DDGL_CAIRO -c -o $@
../build/dgl/Window.cpp.cairo.o: src/Window.cpp src/sofd/* src/pugl/*
-@mkdir -p ../build/dgl
@echo "Compiling $< (Cairo variant)"
- @$(CXX) $< $(BUILD_CXX_FLAGS) $(CAIRO_FLAGS) -DDGL_CAIRO -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(CAIRO_FLAGS) -DDGL_CAIRO -c -o $@
../build/dgl/Window.mm.cairo.o: src/Window.cpp src/sofd/* src/pugl/*
-@mkdir -p ../build/dgl
@echo "Compiling $< (Cairo variant)"
- @$(CXX) $< $(BUILD_CXX_FLAGS) $(CAIRO_FLAGS) -DDGL_CAIRO -ObjC++ -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(CAIRO_FLAGS) -DDGL_CAIRO -ObjC++ -c -o $@
# ---------------------------------------------------------------------------------------------------------------------
../build/dgl/%.cpp.opengl.o: src/%.cpp
-@mkdir -p ../build/dgl
@echo "Compiling $< (OpenGL variant)"
- @$(CXX) $< $(BUILD_CXX_FLAGS) $(OPENGL_FLAGS) -DDGL_OPENGL -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(OPENGL_FLAGS) -DDGL_OPENGL -c -o $@
../build/dgl/Window.cpp.opengl.o: src/Window.cpp src/sofd/* src/pugl/*
-@mkdir -p ../build/dgl
@echo "Compiling $< (OpenGL variant)"
- @$(CXX) $< $(BUILD_CXX_FLAGS) $(OPENGL_FLAGS) -DDGL_OPENGL -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(OPENGL_FLAGS) -DDGL_OPENGL -c -o $@
../build/dgl/Window.mm.opengl.o: src/Window.cpp src/sofd/* src/pugl/*
-@mkdir -p ../build/dgl
@echo "Compiling $< (OpenGL variant)"
- @$(CXX) $< $(BUILD_CXX_FLAGS) $(OPENGL_FLAGS) -DDGL_OPENGL -ObjC++ -c -o $@
+ $(SILENT)$(CXX) $< $(BUILD_CXX_FLAGS) $(OPENGL_FLAGS) -DDGL_OPENGL -ObjC++ -c -o $@
# ---------------------------------------------------------------------------------------------------------------------
diff --git a/dgl/src/ImageWidgets.cpp b/dgl/src/ImageWidgets.cpp
index 71276e36..de94ca02 100644
--- a/dgl/src/ImageWidgets.cpp
+++ b/dgl/src/ImageWidgets.cpp
@@ -25,6 +25,7 @@ START_NAMESPACE_DGL
// -----------------------------------------------------------------------
+#ifndef DISTRHO_OS_HAIKU
ImageAboutWindow::ImageAboutWindow(Window& parent, const Image& image)
: Window(parent.getApp(), parent),
Widget((Window&)*this),
@@ -44,6 +45,10 @@ ImageAboutWindow::ImageAboutWindow(Widget* widget, const Image& image)
Window::setSize(image.getSize());
Window::setTitle("About");
}
+#else
+ImageAboutWindow::ImageAboutWindow(Window& parent, const Image& image) : fImgBackground(image) {}
+ImageAboutWindow::ImageAboutWindow(Widget* widget, const Image& image) : fImgBackground(image) {}
+#endif
void ImageAboutWindow::setImage(const Image& image)
{
@@ -51,9 +56,12 @@ void ImageAboutWindow::setImage(const Image& image)
return;
fImgBackground = image;
+#ifndef DISTRHO_OS_HAIKU
Window::setSize(image.getSize());
+#endif
}
+#ifndef DISTRHO_OS_HAIKU
void ImageAboutWindow::onDisplay()
{
fImgBackground.draw();
@@ -86,6 +94,7 @@ void ImageAboutWindow::onReshape(uint width, uint height)
Widget::setSize(width, height);
Window::onReshape(width, height);
}
+#endif
// -----------------------------------------------------------------------
diff --git a/dgl/src/Window.cpp b/dgl/src/Window.cpp
index f715e549..61218b08 100644
--- a/dgl/src/Window.cpp
+++ b/dgl/src/Window.cpp
@@ -37,14 +37,17 @@
# pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif
-#if defined(DISTRHO_OS_WINDOWS)
-# include "pugl/pugl_win.cpp"
-# undef max
-# undef min
+#if defined(DISTRHO_OS_HAIKU)
+# define DGL_DEBUG_EVENTS
+# include "pugl/pugl_haiku.cpp"
#elif defined(DISTRHO_OS_MAC)
# define PuglWindow DISTRHO_JOIN_MACRO(PuglWindow, DGL_NAMESPACE)
# define PuglOpenGLView DISTRHO_JOIN_MACRO(PuglOpenGLView, DGL_NAMESPACE)
# include "pugl/pugl_osx.m"
+#elif defined(DISTRHO_OS_WINDOWS)
+# include "pugl/pugl_win.cpp"
+# undef max
+# undef min
#else
# include
# include
@@ -99,9 +102,10 @@ struct Window::PrivateData {
fTitle(nullptr),
fWidgets(),
fModal(),
-#if defined(DISTRHO_OS_WINDOWS)
- hwnd(nullptr),
- hwndParent(nullptr)
+#if defined(DISTRHO_OS_HAIKU)
+ bApplication(nullptr),
+ bView(nullptr),
+ bWindow(nullptr)
#elif defined(DISTRHO_OS_MAC)
fNeedsIdle(true),
mView(nullptr),
@@ -111,6 +115,9 @@ struct Window::PrivateData {
, fOpenFilePanel(nullptr),
fFilePanelDelegate(nullptr)
# endif
+#elif defined(DISTRHO_OS_WINDOWS)
+ hwnd(nullptr),
+ hwndParent(nullptr)
#else
xDisplay(nullptr),
xWindow(0)
@@ -135,9 +142,10 @@ struct Window::PrivateData {
fTitle(nullptr),
fWidgets(),
fModal(parent.pData),
-#if defined(DISTRHO_OS_WINDOWS)
- hwnd(nullptr),
- hwndParent(nullptr)
+#if defined(DISTRHO_OS_HAIKU)
+ bApplication(nullptr),
+ bView(nullptr),
+ bWindow(nullptr)
#elif defined(DISTRHO_OS_MAC)
fNeedsIdle(false),
mView(nullptr),
@@ -147,6 +155,9 @@ struct Window::PrivateData {
, fOpenFilePanel(nullptr),
fFilePanelDelegate(nullptr)
# endif
+#elif defined(DISTRHO_OS_WINDOWS)
+ hwnd(nullptr),
+ hwndParent(nullptr)
#else
xDisplay(nullptr),
xWindow(0)
@@ -158,11 +169,13 @@ struct Window::PrivateData {
const PuglInternals* const parentImpl(parent.pData->fView->impl);
// NOTE: almost a 1:1 copy of setTransientWinId()
-#if defined(DISTRHO_OS_WINDOWS)
- hwndParent = parentImpl->hwnd;
- SetWindowLongPtr(hwnd, GWLP_HWNDPARENT, (LONG_PTR)hwndParent);
+#if defined(DISTRHO_OS_HAIKU)
+ // TODO
#elif defined(DISTRHO_OS_MAC)
mParentWindow = parentImpl->window;
+#elif defined(DISTRHO_OS_WINDOWS)
+ hwndParent = parentImpl->hwnd;
+ SetWindowLongPtr(hwnd, GWLP_HWNDPARENT, (LONG_PTR)hwndParent);
#else
XSetTransientForHint(xDisplay, xWindow, parentImpl->win);
#endif
@@ -183,9 +196,10 @@ struct Window::PrivateData {
fTitle(nullptr),
fWidgets(),
fModal(),
-#if defined(DISTRHO_OS_WINDOWS)
- hwnd(nullptr),
- hwndParent(nullptr)
+#if defined(DISTRHO_OS_HAIKU)
+ bApplication(nullptr),
+ bView(nullptr),
+ bWindow(nullptr)
#elif defined(DISTRHO_OS_MAC)
fNeedsIdle(parentId == 0),
mView(nullptr),
@@ -195,6 +209,9 @@ struct Window::PrivateData {
, fOpenFilePanel(nullptr),
fFilePanelDelegate(nullptr)
# endif
+#elif defined(DISTRHO_OS_WINDOWS)
+ hwnd(nullptr),
+ hwndParent(nullptr)
#else
xDisplay(nullptr),
xWindow(0)
@@ -249,9 +266,10 @@ struct Window::PrivateData {
PuglInternals* impl = fView->impl;
-#if defined(DISTRHO_OS_WINDOWS)
- hwnd = impl->hwnd;
- DISTRHO_SAFE_ASSERT(hwnd != 0);
+#if defined(DISTRHO_OS_HAIKU)
+ bApplication = impl->app;
+ bView = impl->view;
+ bWindow = impl->window;
#elif defined(DISTRHO_OS_MAC)
mView = impl->view;
mWindow = impl->window;
@@ -261,6 +279,9 @@ struct Window::PrivateData {
} else {
DISTRHO_SAFE_ASSERT(mWindow != nullptr);
}
+#elif defined(DISTRHO_OS_WINDOWS)
+ hwnd = impl->hwnd;
+ DISTRHO_SAFE_ASSERT(hwnd != 0);
#else
xDisplay = impl->display;
xWindow = impl->win;
@@ -281,7 +302,6 @@ struct Window::PrivateData {
XInternAtom(xDisplay, "_NET_WM_WINDOW_TYPE_NORMAL", False)
};
XChangeProperty(xDisplay, xWindow, _wt, XA_ATOM, 32, PropModeReplace, (const uchar*)&_wts, 2);
-
}
#endif
puglEnterContext(fView);
@@ -327,11 +347,15 @@ struct Window::PrivateData {
fTitle = nullptr;
}
-#if defined(DISTRHO_OS_WINDOWS)
- hwnd = 0;
+#if defined(DISTRHO_OS_HAIKU)
+ bApplication = nullptr;
+ bView = nullptr;
+ bWindow = nullptr;
#elif defined(DISTRHO_OS_MAC)
mView = nullptr;
mWindow = nullptr;
+#elif defined(DISTRHO_OS_WINDOWS)
+ hwnd = 0;
#else
xDisplay = nullptr;
xWindow = 0;
@@ -419,10 +443,12 @@ struct Window::PrivateData {
// the mouse position probably changed since the modal appeared,
// so send a mouse motion event to the modal's parent window
-#if defined(DISTRHO_OS_WINDOWS)
+#if defined(DISTRHO_OS_HAIKU)
// TODO
#elif defined(DISTRHO_OS_MAC)
// TODO
+#elif defined(DISTRHO_OS_WINDOWS)
+ // TODO
#else
int i, wx, wy;
uint u;
@@ -440,13 +466,26 @@ struct Window::PrivateData {
void focus()
{
DBG("Window focus\n");
-#if defined(DISTRHO_OS_WINDOWS)
- SetForegroundWindow(hwnd);
- SetActiveWindow(hwnd);
- SetFocus(hwnd);
+#if defined(DISTRHO_OS_HAIKU)
+ if (bWindow != nullptr)
+ {
+ if (bWindow->LockLooper())
+ {
+ bWindow->Activate(true);
+ bWindow->UnlockLooper();
+ }
+ }
+ else
+ {
+ bView->MakeFocus(true);
+ }
#elif defined(DISTRHO_OS_MAC)
if (mWindow != nullptr)
[mWindow makeKeyWindow];
+#elif defined(DISTRHO_OS_WINDOWS)
+ SetForegroundWindow(hwnd);
+ SetActiveWindow(hwnd);
+ SetFocus(hwnd);
#else
XRaiseWindow(xDisplay, xWindow);
XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime);
@@ -476,38 +515,28 @@ struct Window::PrivateData {
if (yesNo && fFirstInit)
setSize(fWidth, fHeight, true);
-#if defined(DISTRHO_OS_WINDOWS)
- if (yesNo)
+#if defined(DISTRHO_OS_HAIKU)
+ if (bWindow != nullptr)
{
- if (fFirstInit)
+ if (bWindow->LockLooper())
{
- RECT rectChild, rectParent;
-
- if (hwndParent != nullptr &&
- GetWindowRect(hwnd, &rectChild) &&
- GetWindowRect(hwndParent, &rectParent))
- {
- SetWindowPos(hwnd, hwndParent,
- rectParent.left + (rectChild.right-rectChild.left)/2,
- rectParent.top + (rectChild.bottom-rectChild.top)/2,
- 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE);
- }
+ if (yesNo)
+ bWindow->Show();
else
- {
- ShowWindow(hwnd, SW_SHOWNORMAL);
- }
- }
- else
- {
- ShowWindow(hwnd, SW_RESTORE);
+ bWindow->Hide();
+
+ // TODO use flush?
+ bWindow->Sync();
+ bWindow->UnlockLooper();
}
}
else
{
- ShowWindow(hwnd, SW_HIDE);
+ if (yesNo)
+ bView->Show();
+ else
+ bView->Hide();
}
-
- UpdateWindow(hwnd);
#elif defined(DISTRHO_OS_MAC)
if (yesNo)
{
@@ -538,6 +567,38 @@ struct Window::PrivateData {
[mView setHidden:YES];
}
}
+#elif defined(DISTRHO_OS_WINDOWS)
+ if (yesNo)
+ {
+ if (fFirstInit)
+ {
+ RECT rectChild, rectParent;
+
+ if (hwndParent != nullptr &&
+ GetWindowRect(hwnd, &rectChild) &&
+ GetWindowRect(hwndParent, &rectParent))
+ {
+ SetWindowPos(hwnd, hwndParent,
+ rectParent.left + (rectChild.right-rectChild.left)/2,
+ rectParent.top + (rectChild.bottom-rectChild.top)/2,
+ 0, 0, SWP_SHOWWINDOW|SWP_NOSIZE);
+ }
+ else
+ {
+ ShowWindow(hwnd, SW_SHOWNORMAL);
+ }
+ }
+ else
+ {
+ ShowWindow(hwnd, SW_RESTORE);
+ }
+ }
+ else
+ {
+ ShowWindow(hwnd, SW_HIDE);
+ }
+
+ UpdateWindow(hwnd);
#else
if (yesNo)
XMapRaised(xDisplay, xWindow);
@@ -579,13 +640,18 @@ struct Window::PrivateData {
fResizable = yesNo;
fView->user_resizable = yesNo;
-#if defined(DISTRHO_OS_WINDOWS)
+#if defined(DISTRHO_OS_HAIKU)
+ // TODO
+ // B_NO_BORDER
+ // B_TITLED_WINDOW_LOOK
+ // bWindow->SetFlags();
+#elif defined(DISTRHO_OS_MAC)
+ const uint flags = yesNo ? (NSViewWidthSizable|NSViewHeightSizable) : 0x0;
+ [mView setAutoresizingMask:flags];
+#elif defined(DISTRHO_OS_WINDOWS)
const int winFlags = fResizable ? GetWindowLong(hwnd, GWL_STYLE) | WS_SIZEBOX
: GetWindowLong(hwnd, GWL_STYLE) & ~WS_SIZEBOX;
SetWindowLong(hwnd, GWL_STYLE, winFlags);
-#elif defined(DISTRHO_OS_MAC)
- const uint flags(yesNo ? (NSViewWidthSizable|NSViewHeightSizable) : 0x0);
- [mView setAutoresizingMask:flags];
#endif
setSize(fWidth, fHeight, true);
@@ -624,16 +690,20 @@ struct Window::PrivateData {
DBGp("Window setSize called %s, size %i %i, resizable %s\n", forced ? "(forced)" : "(not forced)", width, height, fResizable?"true":"false");
-#if defined(DISTRHO_OS_WINDOWS)
- const int winFlags = WS_POPUPWINDOW | WS_CAPTION | (fResizable ? WS_SIZEBOX : 0x0);
- RECT wr = { 0, 0, static_cast(width), static_cast(height) };
- AdjustWindowRectEx(&wr, fUsingEmbed ? WS_CHILD : winFlags, FALSE, WS_EX_TOPMOST);
+#if defined(DISTRHO_OS_HAIKU)
+ bView->ResizeTo(width, height);
- SetWindowPos(hwnd, 0, 0, 0, wr.right-wr.left, wr.bottom-wr.top,
- SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER);
+ if (bWindow != nullptr && bWindow->LockLooper())
+ {
+ bWindow->MoveTo(50, 50);
+ bWindow->ResizeTo(width, height);
- if (! forced)
- UpdateWindow(hwnd);
+ if (! forced)
+ bWindow->Flush();
+
+ bWindow->UnlockLooper();
+ }
+ // TODO resizable
#elif defined(DISTRHO_OS_MAC)
[mView setFrame:NSMakeRect(0, 0, width, height)];
@@ -655,6 +725,16 @@ struct Window::PrivateData {
[[mWindow standardWindowButton:NSWindowZoomButton] setHidden:YES];
}
}
+#elif defined(DISTRHO_OS_WINDOWS)
+ const int winFlags = WS_POPUPWINDOW | WS_CAPTION | (fResizable ? WS_SIZEBOX : 0x0);
+ RECT wr = { 0, 0, static_cast(width), static_cast(height) };
+ AdjustWindowRectEx(&wr, fUsingEmbed ? WS_CHILD : winFlags, FALSE, WS_EX_TOPMOST);
+
+ SetWindowPos(hwnd, 0, 0, 0, wr.right-wr.left, wr.bottom-wr.top,
+ SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER);
+
+ if (! forced)
+ UpdateWindow(hwnd);
#else
if (! fResizable)
@@ -700,8 +780,12 @@ struct Window::PrivateData {
fTitle = strdup(title);
-#if defined(DISTRHO_OS_WINDOWS)
- SetWindowTextA(hwnd, title);
+#if defined(DISTRHO_OS_HAIKU)
+ if (bWindow != nullptr&& bWindow->LockLooper())
+ {
+ bWindow->SetTitle(title);
+ bWindow->UnlockLooper();
+ }
#elif defined(DISTRHO_OS_MAC)
if (mWindow != nullptr)
{
@@ -712,6 +796,8 @@ struct Window::PrivateData {
[mWindow setTitle:titleString];
}
+#elif defined(DISTRHO_OS_WINDOWS)
+ SetWindowTextA(hwnd, title);
#else
XStoreName(xDisplay, xWindow, title);
Atom netWmName = XInternAtom(xDisplay, "_NET_WM_NAME", False);
@@ -724,15 +810,17 @@ struct Window::PrivateData {
{
DISTRHO_SAFE_ASSERT_RETURN(winId != 0,);
-#if defined(DISTRHO_OS_WINDOWS)
- hwndParent = (HWND)winId;
- SetWindowLongPtr(hwnd, GWLP_HWNDPARENT, (LONG_PTR)winId);
+#if defined(DISTRHO_OS_HAIKU)
+ // TODO
#elif defined(DISTRHO_OS_MAC)
NSWindow* const parentWindow = [NSApp windowWithWindowNumber:winId];
DISTRHO_SAFE_ASSERT_RETURN(parentWindow != nullptr,);
[parentWindow addChildWindow:mWindow
ordered:NSWindowAbove];
+#elif defined(DISTRHO_OS_WINDOWS)
+ hwndParent = (HWND)winId;
+ SetWindowLongPtr(hwnd, GWLP_HWNDPARENT, (LONG_PTR)winId);
#else
XSetTransientForHint(xDisplay, xWindow, static_cast< ::Window>(winId));
#endif
@@ -780,6 +868,15 @@ struct Window::PrivateData {
{
puglProcessEvents(fView);
+#ifdef DISTRHO_OS_HAIKU
+ if (bApplication != nullptr)
+ {
+ // bApplication->Lock();
+ // bApplication->Loop();
+ // bApplication->Unlock();
+ }
+#endif
+
#ifdef DISTRHO_OS_MAC
if (fNeedsIdle)
{
@@ -1164,12 +1261,10 @@ struct Window::PrivateData {
DISTRHO_DECLARE_NON_COPY_STRUCT(Modal)
} fModal;
-#if defined(DISTRHO_OS_WINDOWS)
- HWND hwnd;
- HWND hwndParent;
-# ifndef DGL_FILE_BROWSER_DISABLED
- String fSelectedFile;
-# endif
+#if defined(DISTRHO_OS_HAIKU)
+ BApplication* bApplication;
+ BView* bView;
+ BWindow* bWindow;
#elif defined(DISTRHO_OS_MAC)
bool fNeedsIdle;
NSView* mView;
@@ -1179,6 +1274,12 @@ struct Window::PrivateData {
NSOpenPanel* fOpenFilePanel;
id fFilePanelDelegate;
# endif
+#elif defined(DISTRHO_OS_WINDOWS)
+ HWND hwnd;
+ HWND hwndParent;
+# ifndef DGL_FILE_BROWSER_DISABLED
+ String fSelectedFile;
+# endif
#else
Display* xDisplay;
::Window xWindow;
diff --git a/dgl/src/pugl/pugl_haiku.cpp b/dgl/src/pugl/pugl_haiku.cpp
new file mode 100644
index 00000000..d7f8dca3
--- /dev/null
+++ b/dgl/src/pugl/pugl_haiku.cpp
@@ -0,0 +1,441 @@
+/*
+ Copyright 2019 Filipe Coelho
+
+ Permission to use, copy, modify, and/or distribute this software for any
+ purpose with or without fee is hereby granted, provided that the above
+ copyright notice and this permission notice appear in all copies.
+
+ THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+*/
+
+/**
+ @file pugl_haiku.cpp BeOS/HaikuOS Pugl Implementation.
+*/
+
+#include
+#include
+
+#ifdef PUGL_CAIRO
+#include
+typedef BView BViewType;
+#endif
+#ifdef PUGL_OPENGL
+#include
+#include
+typedef BGLView BViewType;
+#endif
+
+#include "pugl_internal.h"
+
+class DWindow;
+
+struct PuglInternalsImpl {
+ BApplication* app;
+ BViewType* view;
+ DWindow* window;
+};
+
+static void
+puglReshape(PuglView* view, int width, int height)
+{
+ puglEnterContext(view);
+
+ if (view->reshapeFunc) {
+ view->reshapeFunc(view, width, height);
+ } else {
+ puglDefaultReshape(width, height);
+ }
+
+ puglLeaveContext(view, false);
+
+ view->width = width;
+ view->height = height;
+}
+
+static void
+puglDisplay(PuglView* view)
+{
+ puglEnterContext(view);
+
+ view->redisplay = false;
+ if (view->displayFunc) {
+ view->displayFunc(view);
+ }
+
+ puglLeaveContext(view, true);
+}
+
+void
+puglEnterContext(PuglView* view)
+{
+ PuglInternals* impl = view->impl;
+
+#ifdef PUGL_OPENGL
+ // FIXME without the first unlock we freeze
+ impl->view->UnlockGL();
+ impl->view->LockGL();
+#endif
+}
+
+void
+puglLeaveContext(PuglView* view, bool flush)
+{
+ PuglInternals* impl = view->impl;
+
+#ifdef PUGL_OPENGL
+ if (flush)
+ impl->view->SwapBuffers();
+
+ impl->view->UnlockGL();
+#endif
+}
+
+PuglInternals*
+puglInitInternals()
+{
+ return (PuglInternals*)calloc(1, sizeof(PuglInternals));
+}
+
+class DView : public BViewType
+{
+public:
+#ifdef PUGL_CAIRO
+ DView(PuglView* const v)
+ : BView(nullptr,
+ B_FULL_UPDATE_ON_RESIZE|B_WILL_DRAW|B_FRAME_EVENTS|B_NAVIGABLE|B_INPUT_METHOD_AWARE),
+ puglView(v) {}
+#endif
+
+#ifdef PUGL_OPENGL
+ DView(PuglView* const v)
+ : BGLView(BRect(), // causes "bitmap bounds is much too large: BRect(0.0, 0.0, 4294967296.0, 4294967296.0)"
+ "DPF-GLView",
+ 0x0, // resize mode
+ B_FULL_UPDATE_ON_RESIZE|B_WILL_DRAW|B_NAVIGABLE_JUMP|B_FRAME_EVENTS|B_NAVIGABLE|B_INPUT_METHOD_AWARE,
+ BGL_RGB|BGL_DOUBLE|BGL_ALPHA|BGL_DEPTH|BGL_STENCIL),
+ puglView(v)
+ {
+ }
+#endif
+
+protected:
+ void GetPreferredSize(float* width, float* height) override
+ {
+ d_stdout("%s %i", __func__, __LINE__);
+ if (width != nullptr)
+ *width = puglView->width;
+ if (height != nullptr)
+ *height = puglView->height;
+ d_stdout("%s %i", __func__, __LINE__);
+ }
+
+ void Draw(BRect updateRect) override
+ {
+ d_stdout("%s %i", __func__, __LINE__);
+ puglDisplay(puglView);
+#ifdef PUGL_OPENGL
+ BGLView::Draw(updateRect);
+ d_stdout("%s %i", __func__, __LINE__);
+#endif
+ }
+
+ void MessageReceived(BMessage* message)
+ {
+ d_stdout("MessageReceived %p", message);
+ BViewType::MessageReceived(message);
+ }
+
+ void MouseDown(BPoint where) override
+ {
+ if (puglView->mouseFunc) {
+ // puglView->event_timestamp_ms = GetMessageTime();
+ d_stdout("MouseDown mask %u", EventMask());
+ puglView->mouseFunc(puglView, 1, true, where.x, where.y);
+ SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS);
+ }
+ //BViewType::MouseDown(where);
+ }
+
+ void MouseUp(BPoint where) override
+ {
+ if (puglView->mouseFunc) {
+ d_stdout("MouseUp mask %u", EventMask());
+ // puglView->event_timestamp_ms = GetMessageTime();
+ puglView->mouseFunc(puglView, 1, false, where.x, where.y);
+ }
+ //BViewType::MouseUp(where);
+ }
+
+ void MouseMoved(BPoint where, uint32, const BMessage*) override
+ {
+ if (puglView->motionFunc) {
+ // puglView->event_timestamp_ms = GetMessageTime();
+ puglView->motionFunc(puglView, where.x, where.y);
+ }
+ }
+
+ void KeyDown(const char* bytes, int32 numBytes) override
+ {
+ d_stdout("KeyDown %i", numBytes);
+ if (numBytes != 1)
+ return; // TODO
+
+ if (puglView->keyboardFunc) {
+ puglView->keyboardFunc(puglView, true, bytes[0]);
+ }
+ }
+
+ void KeyUp(const char* bytes, int32 numBytes) override
+ {
+ d_stdout("KeyUp %i", numBytes);
+ if (numBytes != 1)
+ return; // TODO
+
+ if (puglView->keyboardFunc) {
+ puglView->keyboardFunc(puglView, false, bytes[0]);
+ }
+ }
+
+ void ScrollTo(BPoint where) override
+ {
+ d_stdout("ScrollTo mask %u", EventMask());
+ BViewType::ScrollTo(where);
+ }
+
+ void FrameResized(float newWidth, float newHeight) override
+ {
+ d_stdout("%s %i", __func__, __LINE__);
+ puglReshape(puglView, static_cast(newWidth), static_cast(newHeight));
+#ifdef PUGL_OPENGL
+ BGLView::FrameResized(newWidth, newHeight);
+#endif
+ d_stdout("%s %i", __func__, __LINE__);
+ }
+
+private:
+ PuglView* const puglView;
+};
+
+class DWindow : public BWindow
+{
+public:
+ DWindow(PuglView* const v)
+ : BWindow(BRect(1.0f), "DPF-Window", B_TITLED_WINDOW, 0x0),
+ puglView(v),
+ needsQuit(true)
+ {
+ }
+
+ bool NeedsQuit() const
+ {
+ return needsQuit;
+ }
+
+protected:
+ bool QuitRequested() override
+ {
+ d_stdout("%s %i", __func__, __LINE__);
+ if (puglView->closeFunc) {
+ puglView->closeFunc(puglView);
+ puglView->redisplay = false;
+ }
+ needsQuit = false;
+ d_stdout("%s %i", __func__, __LINE__);
+ return true;
+ }
+
+private:
+ PuglView* const puglView;
+ bool needsQuit;
+};
+
+int
+puglCreateWindow(PuglView* view, const char* title)
+{
+ PuglInternals* impl = view->impl;
+
+ if (be_app == nullptr)
+ {
+ d_stdout("creating app");
+ status_t status;
+ BApplication* const app = new BApplication("application/x-vnd.dpf-application", &status);
+
+ if (status != B_OK)
+ {
+ d_stdout("app status error %u", status);
+ delete app;
+ return 1;
+ }
+
+ impl->app = app;
+ }
+ else
+ {
+ d_stdout("using existing app");
+ }
+
+ if (view->parent == 0) {
+ impl->window = new DWindow(view);
+ impl->window->Lock();
+ }
+
+ impl->view = new DView(view);
+
+ if (view->parent != 0) {
+ BView* const pview = (BView*)view->parent;
+ pview->AddChild(impl->view);
+ impl->view->LockGL();
+ return 0;
+ }
+
+ if (title != nullptr) {
+ impl->window->SetTitle(title);
+ }
+
+ impl->window->AddChild(impl->view);
+ impl->view->LockGL();
+ //puglEnterContext(view);
+ impl->window->Unlock();
+ return 0;
+}
+
+void
+puglShowWindow(PuglView* view)
+{
+ PuglInternals* impl = view->impl;
+
+ if (impl->window != nullptr)
+ {
+ if (impl->window->LockLooper())
+ {
+ impl->window->Show();
+ impl->window->UnlockLooper();
+ }
+ }
+ else
+ {
+ impl->view->Show();
+ }
+}
+
+void
+puglHideWindow(PuglView* view)
+{
+ PuglInternals* impl = view->impl;
+
+ if (impl->window != nullptr)
+ {
+ if (impl->window->LockLooper())
+ {
+ impl->window->Hide();
+ impl->window->UnlockLooper();
+ }
+ }
+ else
+ {
+ impl->view->Show();
+ }
+}
+
+void
+puglDestroy(PuglView* view)
+{
+ PuglInternals* impl = view->impl;
+
+ if (impl->window != nullptr)
+ {
+ // impl->window->Lock();
+ puglLeaveContext(view, false);
+ impl->window->RemoveChild(impl->view);
+ // impl->window->Unlock();
+
+ if (impl->window->NeedsQuit())
+ impl->window->Quit();
+ }
+
+ delete impl->view;
+ impl->view = nullptr;
+ impl->window = nullptr;
+
+ if (impl->app != nullptr && impl->app->CountWindows() == 0)
+ {
+ d_stdout("deleting app");
+ delete impl->app;
+ impl->app = nullptr;
+ } else
+ d_stdout("NOT deleting app");
+}
+
+PuglStatus
+puglProcessEvents(PuglView* view)
+{
+ return PUGL_SUCCESS;
+}
+
+void
+puglPostRedisplay(PuglView* view)
+{
+ PuglInternals* impl = view->impl;
+
+ view->redisplay = true;
+
+ if (impl->window != nullptr)
+ {
+ if (impl->window->LockLooper())
+ {
+ impl->view->Invalidate();
+ impl->window->UnlockLooper();
+ }
+ }
+ else
+ {
+ impl->view->Invalidate();
+ }
+}
+
+PuglNativeWindow
+puglGetNativeWindow(PuglView* view)
+{
+ PuglInternals* impl = view->impl;
+
+#ifdef PUGL_OPENGL
+ // return (PuglNativeWindow)impl->view->EmbeddedView();
+#endif
+
+ return (PuglNativeWindow)(BView*)impl->view;
+}
+
+void*
+puglGetContext(PuglView* view)
+{
+ return NULL;
+}
+
+int
+puglUpdateGeometryConstraints(PuglView* view, int min_width, int min_height, bool aspect)
+{
+ PuglInternals* impl = view->impl;
+
+ d_stdout("puglUpdateGeometryConstraints %i %i %i %i", min_width, min_height, view->width, view->height);
+ if (impl->window->LockLooper())
+ {
+ impl->window->SetSizeLimits(min_width,
+ view->user_resizable ? 4096 : min_width,
+ min_height,
+ view->user_resizable ? 4096 : min_height);
+
+ impl->window->UnlockLooper();
+ return 0;
+ }
+
+ return 1;
+
+ // TODO
+ (void)aspect;
+}
diff --git a/dgl/src/pugl/pugl_win.cpp b/dgl/src/pugl/pugl_win.cpp
index d8b3866d..90aa5975 100644
--- a/dgl/src/pugl/pugl_win.cpp
+++ b/dgl/src/pugl/pugl_win.cpp
@@ -392,8 +392,6 @@ handleMessage(PuglView* view, UINT message, WPARAM wParam, LPARAM lParam)
case WM_SIZE:
GetClientRect(view->impl->hwnd, &rect);
puglReshape(view, rect.right, rect.bottom);
- view->width = rect.right;
- view->height = rect.bottom;
break;
case WM_GETMINMAXINFO:
mmi = (MINMAXINFO*)lParam;
diff --git a/distrho/DistrhoPlugin.hpp b/distrho/DistrhoPlugin.hpp
index 913f7ddd..896db5c4 100644
--- a/distrho/DistrhoPlugin.hpp
+++ b/distrho/DistrhoPlugin.hpp
@@ -365,6 +365,8 @@ struct ParameterEnumerationValues {
values = nullptr;
}
}
+
+ DISTRHO_DECLARE_NON_COPY_STRUCT(ParameterEnumerationValues)
};
/**
diff --git a/distrho/src/DistrhoDefines.h b/distrho/src/DistrhoDefines.h
index 14492f6c..a2e5522c 100644
--- a/distrho/src/DistrhoDefines.h
+++ b/distrho/src/DistrhoDefines.h
@@ -128,7 +128,12 @@ private: \
StructName& operator=(StructName&) = delete; \
StructName& operator=(const StructName&) = delete;
#else
-# define DISTRHO_DECLARE_NON_COPY_STRUCT(StructName)
+# define DISTRHO_DECLARE_NON_COPY_STRUCT(StructName) \
+private: \
+ StructName(StructName&); \
+ StructName(const StructName&); \
+ StructName& operator=(StructName&); \
+ StructName& operator=(const StructName&);
#endif
/* Define DISTRHO_PREVENT_HEAP_ALLOCATION */
diff --git a/distrho/src/DistrhoPluginChecks.h b/distrho/src/DistrhoPluginChecks.h
index 01a52a16..1bdb5a48 100644
--- a/distrho/src/DistrhoPluginChecks.h
+++ b/distrho/src/DistrhoPluginChecks.h
@@ -97,7 +97,7 @@
// Define DISTRHO_PLUGIN_HAS_EMBED_UI if needed
#ifndef DISTRHO_PLUGIN_HAS_EMBED_UI
-# if defined(HAVE_CAIRO) || defined(HAVE_OPENGL)
+# if (defined(DGL_CAIRO) && defined(HAVE_CAIRO)) || (defined(DGL_OPENGL) && defined(HAVE_OPENGL))
# define DISTRHO_PLUGIN_HAS_EMBED_UI 1
# else
# define DISTRHO_PLUGIN_HAS_EMBED_UI 0
@@ -139,7 +139,12 @@
// -----------------------------------------------------------------------
// Disable UI if DGL or External UI is not available
-#if DISTRHO_PLUGIN_HAS_UI && ! DISTRHO_PLUGIN_HAS_EXTERNAL_UI && ! defined(HAVE_CAIRO) && ! defined(HAVE_OPENGL)
+#if (defined(DGL_CAIRO) && ! defined(HAVE_CAIRO)) || (defined(DGL_OPENGL) && ! defined(HAVE_OPENGL))
+# undef DISTRHO_PLUGIN_HAS_EMBED_UI
+# define DISTRHO_PLUGIN_HAS_EMBED_UI 0
+#endif
+
+#if DISTRHO_PLUGIN_HAS_UI && ! DISTRHO_PLUGIN_HAS_EMBED_UI && ! DISTRHO_PLUGIN_HAS_EXTERNAL_UI
# undef DISTRHO_PLUGIN_HAS_UI
# define DISTRHO_PLUGIN_HAS_UI 0
#endif
diff --git a/distrho/src/DistrhoPluginLV2.cpp b/distrho/src/DistrhoPluginLV2.cpp
index 5410bf17..8e28457f 100644
--- a/distrho/src/DistrhoPluginLV2.cpp
+++ b/distrho/src/DistrhoPluginLV2.cpp
@@ -166,6 +166,44 @@ public:
// -------------------------------------------------------------------
+ bool getPortControlValue(uint32_t index, float& value) const
+ {
+ if (const float* control = fPortControls[index])
+ {
+ switch (fPlugin.getParameterDesignation(index))
+ {
+ default:
+ value = *control;
+ break;
+ case kParameterDesignationBypass:
+ value = 1.0f - *control;
+ break;
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ void setPortControlValue(uint32_t index, float value)
+ {
+ if (float* control = fPortControls[index])
+ {
+ switch (fPlugin.getParameterDesignation(index))
+ {
+ default:
+ *control = value;
+ break;
+ case kParameterDesignationBypass:
+ *control = 1.0f - value;
+ break;
+ }
+ }
+ }
+
+ // -------------------------------------------------------------------
+
void lv2_activate()
{
#if DISTRHO_PLUGIN_WANT_TIMEPOS
@@ -514,18 +552,13 @@ public:
for (uint32_t i=0, count=fPlugin.getParameterCount(); i < count; ++i)
{
- if (fPortControls[i] == nullptr)
+ if (!getPortControlValue(i, curValue))
continue;
- curValue = *fPortControls[i];
-
if (fPlugin.isParameterInput(i) && d_isNotEqual(fLastControlValues[i], curValue))
{
fLastControlValues[i] = curValue;
- if (fPlugin.getParameterDesignation(i) == kParameterDesignationBypass)
- curValue = 1.0f - curValue;
-
fPlugin.setParameterValue(i, curValue);
}
}
@@ -757,8 +790,7 @@ public:
fLastControlValues[i] = fPlugin.getParameterValue(i);
- if (fPortControls[i] != nullptr)
- *fPortControls[i] = fLastControlValues[i];
+ setPortControlValue(i, fLastControlValues[i]);
}
# if DISTRHO_PLUGIN_WANT_FULL_STATE
@@ -1047,8 +1079,7 @@ private:
{
curValue = fLastControlValues[i] = fPlugin.getParameterValue(i);
- if (fPortControls[i] != nullptr)
- *fPortControls[i] = curValue;
+ setPortControlValue(i, curValue);
}
else if ((fPlugin.getParameterHints(i) & kParameterIsTrigger) == kParameterIsTrigger)
{
diff --git a/distrho/src/DistrhoPluginLV2export.cpp b/distrho/src/DistrhoPluginLV2export.cpp
index 3c44b872..681b1b1b 100644
--- a/distrho/src/DistrhoPluginLV2export.cpp
+++ b/distrho/src/DistrhoPluginLV2export.cpp
@@ -160,7 +160,7 @@ static const char* const lv2ManifestUiSupportedOptions[] =
};
#endif // DISTRHO_PLUGIN_HAS_UI
-static void addAttribute(String& text,
+static void addAttribute(DISTRHO_NAMESPACE::String& text,
const char* const attribute,
const char* const values[],
const uint indent,
@@ -561,7 +561,14 @@ void lv2_generate_ttl(const char* const basename)
pluginString += " [\n";
pluginString += " rdfs:label \"\"\"" + enumValue.label + "\"\"\" ;\n";
- pluginString += " rdf:value " + String(enumValue.value) + " ;\n";
+
+ if (plugin.getParameterHints(i) & kParameterIsInteger) {
+ const int roundedValue = (int)(enumValue.value + 0.5f);
+ pluginString += " rdf:value " + String(roundedValue) + " ;\n";
+ }
+ else {
+ pluginString += " rdf:value " + String(enumValue.value) + " ;\n";
+ }
if (j+1 == enumValues.count)
pluginString += " ] ;\n\n";
@@ -606,6 +613,7 @@ void lv2_generate_ttl(const char* const basename)
else
{
pluginString += " unit:unit [\n";
+ pluginString += " a unit:Unit ;\n";
pluginString += " rdfs:label \"" + unit + "\" ;\n";
pluginString += " unit:symbol \"" + unit + "\" ;\n";
pluginString += " unit:render \"%f " + unit + "\" ;\n";
diff --git a/distrho/src/DistrhoPluginVST.cpp b/distrho/src/DistrhoPluginVST.cpp
index 91446be8..bc57b7ec 100644
--- a/distrho/src/DistrhoPluginVST.cpp
+++ b/distrho/src/DistrhoPluginVST.cpp
@@ -231,6 +231,8 @@ public:
d_stdout("handlePluginKeyEvent %i %i %li\n", down, index, (long int)value);
+ using namespace DGL_NAMESPACE;
+
int special = 0;
switch (value)
{
@@ -588,7 +590,8 @@ public:
return 1;
case effEditOpen:
- if (fVstUI == nullptr)
+ delete fVstUI; // hosts which don't pair effEditOpen/effEditClose calls (Minihost Modular)
+ fVstUI = nullptr;
{
# if DISTRHO_OS_MAC
if (! fUsingNsView)
@@ -920,25 +923,25 @@ public:
return ranges.getNormalizedValue(fPlugin.getParameterValue(index));
}
- void vst_setParameter(const int32_t index, float value)
+ void vst_setParameter(const int32_t index, const float value)
{
const uint32_t hints(fPlugin.getParameterHints(index));
const ParameterRanges& ranges(fPlugin.getParameterRanges(index));
- value = ranges.getUnnormalizedValue(value);
+ // TODO figure out how to detect kVstParameterUsesIntegerMinMax host support, and skip normalization
+ float realValue = ranges.getUnnormalizedValue(value);
if (hints & kParameterIsBoolean)
{
const float midRange = ranges.min + (ranges.max - ranges.min) / 2.0f;
- value = value > midRange ? ranges.max : ranges.min;
+ realValue = realValue > midRange ? ranges.max : ranges.min;
}
if (hints & kParameterIsInteger)
{
- value = std::round(value);
+ realValue = std::round(realValue);
}
- const float realValue(value);
fPlugin.setParameterValue(index, realValue);
#if DISTRHO_PLUGIN_HAS_UI
diff --git a/distrho/src/DistrhoUIDSSI.cpp b/distrho/src/DistrhoUIDSSI.cpp
index b11e1d0f..b259c6e0 100644
--- a/distrho/src/DistrhoUIDSSI.cpp
+++ b/distrho/src/DistrhoUIDSSI.cpp
@@ -149,9 +149,12 @@ public:
fUI.setSampleRate(sampleRate, true);
}
- void dssiui_show()
+ void dssiui_show(const bool focus = false)
{
fUI.setWindowVisible(true);
+
+ if (focus)
+ fUI.focus();
}
void dssiui_hide()
@@ -389,7 +392,7 @@ int main(int argc, char* argv[])
gUiTitle = "DSSI UI Test";
initUiIfNeeded();
- globalUI->dssiui_show();
+ globalUI->dssiui_show(true);
globalUI->exec();
delete globalUI;
diff --git a/distrho/src/DistrhoUIInternal.hpp b/distrho/src/DistrhoUIInternal.hpp
index f1ebb332..f6ddde6d 100644
--- a/distrho/src/DistrhoUIInternal.hpp
+++ b/distrho/src/DistrhoUIInternal.hpp
@@ -406,6 +406,10 @@ public:
return true;
}
+ void focus()
+ {
+ }
+
void quit()
{
DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr,);
@@ -430,6 +434,11 @@ public:
fUI->uiIdle();
}
+ void focus()
+ {
+ glWindow.focus();
+ }
+
bool idle()
{
DISTRHO_SAFE_ASSERT_RETURN(fUI != nullptr, false);
@@ -519,7 +528,7 @@ public:
return glWindow.handlePluginKeyboard(press, key);
}
- bool handlePluginSpecial(const bool press, const Key key)
+ bool handlePluginSpecial(const bool press, const DGL_NAMESPACE::Key key)
{
return glWindow.handlePluginSpecial(press, key);
}
diff --git a/examples/CairoUI/DemoWidgetBanner.cpp b/examples/CairoUI/DemoWidgetBanner.cpp
index 9835e38a..200598e9 100644
--- a/examples/CairoUI/DemoWidgetBanner.cpp
+++ b/examples/CairoUI/DemoWidgetBanner.cpp
@@ -19,6 +19,10 @@
#include "Cairo.hpp"
#include "Window.hpp"
+START_NAMESPACE_DGL
+
+// -----------------------------------------------------------------------
+
static const char* banner =
" "
" * * * * * "
@@ -90,3 +94,7 @@ void DemoWidgetBanner::onDisplay()
}
}
}
+
+// -----------------------------------------------------------------------
+
+END_NAMESPACE_DGL
diff --git a/examples/CairoUI/DemoWidgetBanner.hpp b/examples/CairoUI/DemoWidgetBanner.hpp
index 86ad496a..8571b58e 100644
--- a/examples/CairoUI/DemoWidgetBanner.hpp
+++ b/examples/CairoUI/DemoWidgetBanner.hpp
@@ -16,9 +16,19 @@
#include "Widget.hpp"
+START_NAMESPACE_DGL
+
+// -----------------------------------------------------------------------
+
class DemoWidgetBanner : public Widget
{
public:
explicit DemoWidgetBanner(Widget* group);
void onDisplay() override;
};
+
+// -----------------------------------------------------------------------
+
+END_NAMESPACE_DGL
+
+using DGL_NAMESPACE::DemoWidgetBanner;
diff --git a/examples/CairoUI/DemoWidgetClickable.cpp b/examples/CairoUI/DemoWidgetClickable.cpp
index 67843ff5..23fec617 100644
--- a/examples/CairoUI/DemoWidgetClickable.cpp
+++ b/examples/CairoUI/DemoWidgetClickable.cpp
@@ -19,6 +19,10 @@
#include "Cairo.hpp"
#include "Window.hpp"
+START_NAMESPACE_DGL
+
+// -----------------------------------------------------------------------
+
DemoWidgetClickable::DemoWidgetClickable(Widget* group)
: Widget(group)
{
@@ -77,3 +81,7 @@ bool DemoWidgetClickable::onMouse(const MouseEvent& event)
return Widget::onMouse(event);
}
+
+// -----------------------------------------------------------------------
+
+END_NAMESPACE_DGL
diff --git a/examples/CairoUI/DemoWidgetClickable.hpp b/examples/CairoUI/DemoWidgetClickable.hpp
index 425e773b..a63c85fe 100644
--- a/examples/CairoUI/DemoWidgetClickable.hpp
+++ b/examples/CairoUI/DemoWidgetClickable.hpp
@@ -16,6 +16,10 @@
#include "Widget.hpp"
+START_NAMESPACE_DGL
+
+// -----------------------------------------------------------------------
+
class DemoWidgetClickable : public Widget
{
public:
@@ -26,3 +30,9 @@ public:
private:
unsigned fColorId = 0;
};
+
+// -----------------------------------------------------------------------
+
+END_NAMESPACE_DGL
+
+using DGL_NAMESPACE::DemoWidgetClickable;
diff --git a/examples/CairoUI/Makefile b/examples/CairoUI/Makefile
index 5a954bdb..828029e3 100644
--- a/examples/CairoUI/Makefile
+++ b/examples/CairoUI/Makefile
@@ -35,7 +35,7 @@ TARGETS += jack
endif
endif
-ifeq ($(LINUX),true)
+ifneq ($(MACOS_OR_WINDOWS),true)
ifeq ($(HAVE_CAIRO),true)
ifeq ($(HAVE_LIBLO),true)
TARGETS += dssi
diff --git a/examples/ExternalUI/Makefile b/examples/ExternalUI/Makefile
index ba1df228..932db4d5 100644
--- a/examples/ExternalUI/Makefile
+++ b/examples/ExternalUI/Makefile
@@ -21,9 +21,12 @@ FILES_UI = \
# --------------------------------------------------------------
# Do some magic
+UI_TYPE = external
include ../../Makefile.plugins.mk
+ifneq ($(HAIKU),true)
LINK_FLAGS += -ldl
+endif
# --------------------------------------------------------------
# Enable all possible plugin types
diff --git a/examples/Info/DistrhoPluginInfo.h b/examples/Info/DistrhoPluginInfo.h
index c10a3739..0f7184ff 100644
--- a/examples/Info/DistrhoPluginInfo.h
+++ b/examples/Info/DistrhoPluginInfo.h
@@ -29,6 +29,10 @@
#define DISTRHO_UI_USER_RESIZABLE 1
#define DISTRHO_UI_USE_NANOVG 1
+#ifdef __MOD_DEVICES__
+#define DISTRHO_PLUGIN_USES_MODGUI 1
+#endif
+
enum Parameters {
kParameterBufferSize = 0,
kParameterTimePlaying,
diff --git a/examples/Info/modgui.ttl b/examples/Info/modgui.ttl
new file mode 100644
index 00000000..0b04bfd6
--- /dev/null
+++ b/examples/Info/modgui.ttl
@@ -0,0 +1,42 @@
+@prefix lv2: .
+@prefix mod: .
+@prefix modgui: .
+
+
+ mod:brand "DISTRHO" ;
+ mod:label "Info" ;
+ modgui:gui [
+ modgui:brand "DISTRHO" ;
+ modgui:label "Info" ;
+ modgui:resourcesDirectory ;
+ modgui:iconTemplate ;
+ modgui:stylesheet ;
+ modgui:screenshot ;
+ modgui:thumbnail ;
+ modgui:javascript ;
+ modgui:monitoredOutputs [
+ lv2:symbol "buffer_size" ;
+ ] , [
+ lv2:symbol "time_playing" ;
+ ] , [
+ lv2:symbol "time_frame" ;
+ ] , [
+ lv2:symbol "time_validbbt" ;
+ ] , [
+ lv2:symbol "time_bar" ;
+ ] , [
+ lv2:symbol "time_beat" ;
+ ] , [
+ lv2:symbol "time_tick" ;
+ ] , [
+ lv2:symbol "time_barstarttick" ;
+ ] , [
+ lv2:symbol "time_beatsperbar" ;
+ ] , [
+ lv2:symbol "time_beattype" ;
+ ] , [
+ lv2:symbol "time_ticksperbeat" ;
+ ] , [
+ lv2:symbol "time_beatsperminute" ;
+ ] ;
+ ] .
diff --git a/examples/Info/modgui/box.png b/examples/Info/modgui/box.png
new file mode 100755
index 00000000..e26cda92
Binary files /dev/null and b/examples/Info/modgui/box.png differ
diff --git a/examples/Info/modgui/icon-info.html b/examples/Info/modgui/icon-info.html
new file mode 100755
index 00000000..e7603bdd
--- /dev/null
+++ b/examples/Info/modgui/icon-info.html
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+ Buffer Size: |
+ --- |
+
+
+ Sample Rate: |
+ --- |
+
+
+ Playing: |
+ --- |
+
+
+ Frame: |
+ --- |
+
+
+ Time: |
+ --- |
+
+
+
+
+
+
+ BBT Valid: |
+ --- |
+
+
+ Bar: |
+ --- |
+
+
+ Beat: |
+ --- |
+
+
+ Tick: |
+ --- |
+
+
+ Bar Start Tick: |
+ --- |
+
+
+ Beats Per Bar: |
+ --- |
+
+
+ Beat Type: |
+ --- |
+
+
+ Ticks Per Beat: |
+ --- |
+
+
+ BPM: |
+ --- |
+
+
+
+
+
+
+
+
diff --git a/examples/Info/modgui/screenshot-info.png b/examples/Info/modgui/screenshot-info.png
new file mode 100755
index 00000000..9645075b
Binary files /dev/null and b/examples/Info/modgui/screenshot-info.png differ
diff --git a/examples/Info/modgui/script-info.js b/examples/Info/modgui/script-info.js
new file mode 100644
index 00000000..f7122490
--- /dev/null
+++ b/examples/Info/modgui/script-info.js
@@ -0,0 +1,57 @@
+function (event) {
+
+ function magic () {
+ if (event.data.magicHasHappened) {
+ $('#pedalboard-dashboard').css({
+ 'background': "#111 url(/img/background.jpg) repeat",
+ });
+ } else {
+ $('#pedalboard-dashboard').css({
+ 'background': "#111 url(/resources/tilesf1.jpg?uri=http%3A//distrho.sf.net/examples/Info) repeat",
+ });
+ }
+ event.data.magicHasHappened = !event.data.magicHasHappened;
+ }
+
+ function handle_event (symbol, value) {
+ switch (symbol) {
+ case 'time_playing':
+ case 'time_validbbt':
+ value = value > 0.5 ? "Yes" : "No";
+ break;
+ case 'time_beatsperminute':
+ value = value.toFixed(2);
+ break;
+ case 'time_frame': {
+ var time = value / SAMPLERATE;
+ var secs = time % 60;
+ var mins = (time / 60) % 60;
+ var hrs = (time / 3600) % 60;
+ event.icon.find('[mod-role=time_frame_s]').text(sprintf("%02d:%02d:%02d", hrs, mins, secs));
+ // fall-through
+ }
+ default:
+ value = value.toFixed();
+ break;
+ }
+
+ event.icon.find('[mod-role='+symbol+']').text(value);
+ }
+
+ if (event.type == 'start') {
+ var ports = event.ports;
+ for (var p in ports) {
+ if (ports[p].symbol[0] == ":") {
+ continue;
+ }
+ handle_event (ports[p].symbol, ports[p].value);
+ }
+ // special cases
+ event.icon.find ('[mod-role=sample_rate]').text(SAMPLERATE);
+ event.icon.find ('.mod-magic').click(magic);
+ }
+ else if (event.type == 'change') {
+ handle_event (event.symbol, event.value);
+ }
+
+}
diff --git a/examples/Info/modgui/stylesheet-info.css b/examples/Info/modgui/stylesheet-info.css
new file mode 100755
index 00000000..f922e3e9
--- /dev/null
+++ b/examples/Info/modgui/stylesheet-info.css
@@ -0,0 +1,88 @@
+@import url(/fonts/nexa/stylesheet.css);
+@import url(/fonts/questrial/stylesheet.css);
+
+.distrho-info{{{cns}}} {
+ background-image:url(/resources/box.png{{{ns}}});
+ background-position:center center;
+ background-repeat:no-repeat;
+ background-size:600px 300px;
+ width:600px;
+ height:300px;
+/* position:absolute; */
+ border-radius: 21px;
+/* font-size: 2rem !important; */
+}
+
+.distrho-info{{{cns}}} .mod-pedal-input.mono,
+.distrho-info{{{cns}}} .mod-pedal-output.mono {
+ top: 60px !important;
+}
+
+.distrho-info{{{cns}}} .mod-pedal-input.stereo,
+.distrho-info{{{cns}}} .mod-pedal-output.stereo {
+ top: 15px !important;
+}
+
+.distrho-info{{{cns}}} .mod-logo {
+ background: url(/img/watermark.png) 42px 146px no-repeat;
+ width: 100%;
+ height: 100%;
+ position: absolute;
+ top: 0px;
+ left: 0px;
+}
+
+@keyframes mod-magic{{{cns}}} {
+ 0% {
+ opacity: 0.1;
+ }
+ 100% {
+ opacity: 0.75;
+ }
+}
+
+.distrho-info{{{cns}}} .mod-magic {
+ background: url(/img/social/favicon.png) no-repeat;
+ width: 118px;
+ height: 118px;
+ position: absolute;
+ top: 158px;
+ left: 52px;
+ background-size: cover;
+ opacity: 0;
+ cursor: pointer;
+ z-index: 21;
+ animation: mod-magic{{{cns}}} 5s infinite;
+ animation-direction: alternate;
+ animation-timing-function: ease-in;
+}
+
+.distrho-info{{{cns}}} .tables {
+ display: flex;
+ flex-direction: row;
+ height: 100%;
+ padding: 21px;
+ font-family: monospace;
+ font-size: 1.8rem;
+ font-weight: bold;
+}
+
+.distrho-info{{{cns}}} .table-left,
+.distrho-info{{{cns}}} .table-right {
+ width: 50%;
+}
+.distrho-info{{{cns}}} .table-left {
+ padding-left: 36px;
+}
+
+.distrho-info{{{cns}}} table {
+ border-collapse: separate;
+ border-spacing: 6px 1px;
+}
+
+.distrho-info{{{cns}}} tr > td:first-child {
+ text-align: right;
+}
+.distrho-info{{{cns}}} tr > td:last-child {
+ font-weight: lighter;
+}
diff --git a/examples/Info/modgui/thumbnail-tinygain.png b/examples/Info/modgui/thumbnail-tinygain.png
new file mode 100755
index 00000000..d8205fdb
Binary files /dev/null and b/examples/Info/modgui/thumbnail-tinygain.png differ
diff --git a/examples/Info/modgui/tilesf1.LICENSE b/examples/Info/modgui/tilesf1.LICENSE
new file mode 100644
index 00000000..1e262544
--- /dev/null
+++ b/examples/Info/modgui/tilesf1.LICENSE
@@ -0,0 +1,4 @@
+From http://www.myfreetextures.com/generated-seamless-tile-background-texture/
+
+Fair Use – You can use the images with credit / attribution to www.myfreetextures.com.
+Sometimes it is not possible to give credit directly on a final project – in these cases please mention the site on your website, facebook or similar, whatever you think is fair.
diff --git a/examples/Info/modgui/tilesf1.jpg b/examples/Info/modgui/tilesf1.jpg
new file mode 100644
index 00000000..74e91648
Binary files /dev/null and b/examples/Info/modgui/tilesf1.jpg differ
diff --git a/examples/Latency/Makefile b/examples/Latency/Makefile
index 1a61a70d..c0520530 100644
--- a/examples/Latency/Makefile
+++ b/examples/Latency/Makefile
@@ -23,7 +23,7 @@ include ../../Makefile.plugins.mk
# --------------------------------------------------------------
# Enable all possible plugin types
-ifeq ($(LINUX),true)
+ifneq ($(MACOS_OR_WINDOWS),true)
TARGETS += ladspa
TARGETS += dssi
endif
diff --git a/examples/Meters/ExampleUIMeters.cpp b/examples/Meters/ExampleUIMeters.cpp
index a5873ec3..0f33eff2 100644
--- a/examples/Meters/ExampleUIMeters.cpp
+++ b/examples/Meters/ExampleUIMeters.cpp
@@ -21,7 +21,7 @@ START_NAMESPACE_DISTRHO
/**
We need the Color class from DGL.
*/
-using DGL::Color;
+using DGL_NAMESPACE::Color;
/**
Smooth meters a bit.
diff --git a/examples/Meters/Makefile b/examples/Meters/Makefile
index ac50f2f9..9ac485a5 100644
--- a/examples/Meters/Makefile
+++ b/examples/Meters/Makefile
@@ -32,7 +32,7 @@ TARGETS += jack
endif
endif
-ifeq ($(LINUX),true)
+ifneq ($(MACOS_OR_WINDOWS),true)
ifeq ($(HAVE_LIBLO),true)
ifeq ($(HAVE_OPENGL),true)
TARGETS += dssi
diff --git a/examples/Parameters/ExampleUIParameters.cpp b/examples/Parameters/ExampleUIParameters.cpp
index 3e95ffe8..1c40c79d 100644
--- a/examples/Parameters/ExampleUIParameters.cpp
+++ b/examples/Parameters/ExampleUIParameters.cpp
@@ -21,7 +21,7 @@ START_NAMESPACE_DISTRHO
/**
We need the rectangle class from DGL.
*/
-using DGL::Rectangle;
+using DGL_NAMESPACE::Rectangle;
// -----------------------------------------------------------------------------------------------------------
diff --git a/examples/Parameters/Makefile b/examples/Parameters/Makefile
index f097b403..c8c7cafc 100644
--- a/examples/Parameters/Makefile
+++ b/examples/Parameters/Makefile
@@ -32,7 +32,7 @@ TARGETS += jack
endif
endif
-ifeq ($(LINUX),true)
+ifneq ($(MACOS_OR_WINDOWS),true)
ifeq ($(HAVE_LIBLO),true)
ifeq ($(HAVE_OPENGL),true)
TARGETS += ladspa
diff --git a/examples/States/ExampleUIStates.cpp b/examples/States/ExampleUIStates.cpp
index e8881516..1f197f75 100644
--- a/examples/States/ExampleUIStates.cpp
+++ b/examples/States/ExampleUIStates.cpp
@@ -18,6 +18,11 @@
START_NAMESPACE_DISTRHO
+/**
+ We need the rectangle class from DGL.
+ */
+using DGL_NAMESPACE::Rectangle;
+
// -----------------------------------------------------------------------------------------------------------
class ExampleUIParameters : public UI
diff --git a/examples/States/Makefile b/examples/States/Makefile
index 5f4a4811..e011bc30 100644
--- a/examples/States/Makefile
+++ b/examples/States/Makefile
@@ -32,7 +32,7 @@ TARGETS += jack
endif
endif
-ifeq ($(LINUX),true)
+ifneq ($(MACOS_OR_WINDOWS),true)
ifeq ($(HAVE_LIBLO),true)
ifeq ($(HAVE_OPENGL),true)
TARGETS += dssi
diff --git a/utils/lv2-ttl-generator/GNUmakefile b/utils/lv2-ttl-generator/GNUmakefile
index 490e9343..460b04f9 100644
--- a/utils/lv2-ttl-generator/GNUmakefile
+++ b/utils/lv2-ttl-generator/GNUmakefile
@@ -1,19 +1,29 @@
#!/usr/bin/makefile -f
+include ../../Makefile.base.mk
+
all: build
ifeq ($(WINDOWS),true)
-build: ../lv2_ttl_generator.exe
-else
-build: ../lv2_ttl_generator
-endif
-../lv2_ttl_generator: lv2_ttl_generator.c
- $(CC) $< $(CFLAGS) -o $@ $(LDFLAGS) -ldl
+build: ../lv2_ttl_generator.exe
../lv2_ttl_generator.exe: lv2_ttl_generator.c
$(CC) $< $(CFLAGS) -o $@ $(LDFLAGS) -static
touch ../lv2_ttl_generator
+else # WINDOWS
+
+ifneq ($(HAIKU),true)
+LDFLAGS += -ldl
+endif
+
+build: ../lv2_ttl_generator
+
+../lv2_ttl_generator: lv2_ttl_generator.c
+ $(CC) $< $(CFLAGS) -o $@ $(LDFLAGS)
+
+endif # WINDOWS
+
clean:
rm -f ../lv2_ttl_generator ../lv2_ttl_generator.exe