From 5e7dc35ca969fb572ad94236cb1ac6a935df892b Mon Sep 17 00:00:00 2001 From: falkTX Date: Sat, 11 May 2013 09:14:30 +0100 Subject: [PATCH] Also fix zynaddsubfx for using host resource dir, fixes #50 --- source/backend/native/zynaddsubfx-ui.cpp | 8 ++++++-- source/backend/native/zynaddsubfx.cpp | 19 +++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/source/backend/native/zynaddsubfx-ui.cpp b/source/backend/native/zynaddsubfx-ui.cpp index c15201ff2..559b3aa04 100644 --- a/source/backend/native/zynaddsubfx-ui.cpp +++ b/source/backend/native/zynaddsubfx-ui.cpp @@ -15,9 +15,13 @@ * For a full copy of the GNU General Public License see the GPL.txt file */ -#define PIXMAP_PATH "./resources/zynaddsubfx/" -#define SOURCE_DIR "/usr/share/zynaddsubfx/examples" #define PLUGINVERSION +#define SOURCE_DIR "/usr/share/zynaddsubfx/examples" + +#include "CarlaString.hpp" +#undef override + +CarlaString gUiPixmapPath; // zynaddsubfx ui includes #include "zynaddsubfx/UI/NioUI.cpp" diff --git a/source/backend/native/zynaddsubfx.cpp b/source/backend/native/zynaddsubfx.cpp index b18feef21..9b6aeb41b 100644 --- a/source/backend/native/zynaddsubfx.cpp +++ b/source/backend/native/zynaddsubfx.cpp @@ -76,9 +76,11 @@ namespace Nio { SYNTH_T* synth = nullptr; #ifdef WANT_ZYNADDSUBFX_UI -#define PIXMAP_PATH "./resources/zynaddsubfx/" +#define PIXMAP_PATH "/resources/zynaddsubfx/" static Fl_Tiled_Image* gModuleBackdrop = nullptr; +static CarlaString gPixmapPath; +extern CarlaString gUiPixmapPath; void set_module_parameters(Fl_Widget* o) { @@ -448,13 +450,13 @@ private: Fl_Dial::default_style(Fl_Dial::PIXMAP_DIAL); - if (Fl_Shared_Image* const img = Fl_Shared_Image::get(PIXMAP_PATH "knob.png")) + if (Fl_Shared_Image* const img = Fl_Shared_Image::get(gPixmapPath + "knob.png")) Fl_Dial::default_image(img); - if (Fl_Shared_Image* const img = Fl_Shared_Image::get(PIXMAP_PATH "window_backdrop.png")) + if (Fl_Shared_Image* const img = Fl_Shared_Image::get(gPixmapPath + "window_backdrop.png")) Fl::scheme_bg(new Fl_Tiled_Image(img)); - if(Fl_Shared_Image* const img = Fl_Shared_Image::get(PIXMAP_PATH "module_backdrop.png")) + if(Fl_Shared_Image* const img = Fl_Shared_Image::get(gPixmapPath + "module_backdrop.png")) gModuleBackdrop = new Fl_Tiled_Image(img); Fl::background(50, 50, 50); @@ -588,6 +590,15 @@ public: denormalkillbuf[i] = (RND - 0.5f) * 1e-16; Master::getInstance(); + +#ifdef WANT_ZYNADDSUBFX_UI + if (gPixmapPath.isEmpty()) + { + gPixmapPath = host->resource_dir; + gPixmapPath += PIXMAP_PATH; + gUiPixmapPath = gPixmapPath; + } +#endif } return new ZynAddSubFxPlugin(host);