Browse Source

Allow to use fltk for zynaddsubfx UI

tags/1.9.6
falkTX 11 years ago
parent
commit
33aaf508f5
4 changed files with 52 additions and 13 deletions
  1. +6
    -2
      Makefile
  2. +24
    -3
      source/Makefile.mk
  3. +9
    -2
      source/native-plugins/Makefile
  4. +13
    -6
      source/native-plugins/zynaddsubfx-synth.cpp

+ 6
- 2
Makefile View File

@@ -860,9 +860,13 @@ else
endif
ifeq ($(HAVE_ZYN_DEPS),true)
ifeq ($(HAVE_ZYN_UI_DEPS),true)
@echo "ZynAddSubFX: $(ANS_YES)(with UI)"
ifeq ($(HAVE_NTK),true)
@echo "ZynAddSubFX: $(ANS_YES)(with NTK UI)"
else
@echo "ZynAddSubFX: $(ANS_YES)(without UI) $(mS)NTK missing$(mE)"
@echo "ZynAddSubFX: $(ANS_YES)(with FLTK UI)"
endif
else
@echo "ZynAddSubFX: $(ANS_YES)(without UI) $(mS)FLTK or NTK missing$(mE)"
endif
else
@echo "ZynAddSubFX: $(ANS_NO) $(mS)fftw3, mxml or zlib missing$(mE)"


+ 24
- 3
source/Makefile.mk View File

@@ -157,6 +157,7 @@ HAVE_GTK3 = $(shell pkg-config --exists gtk+-3.0 && echo true)
ifeq ($(LINUX),true)
HAVE_ALSA = $(shell pkg-config --exists alsa && echo true)
HAVE_DGL = $(shell pkg-config --exists gl x11 && echo true)
HAVE_NTK = $(shell pkg-config --exists ntk ntk_images && echo true)
HAVE_PULSEAUDIO = $(shell pkg-config --exists libpulse-simple && echo true)
HAVE_X11 = $(shell pkg-config --exists x11 && echo true)
endif
@@ -170,12 +171,20 @@ HAVE_FLUIDSYNTH = $(shell pkg-config --exists fluidsynth && echo true)
HAVE_LINUXSAMPLER = $(shell pkg-config --atleast-version=1.0.0.svn41 linuxsampler && echo true)
HAVE_PROJECTM = $(shell pkg-config --exists libprojectM && echo true)

HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true)
HAVE_ZYN_UI_DEPS = $(shell pkg-config --exists ntk_images ntk && echo true)
# --------------------------------------------------------------
# Check for optional libs (special non-pkgconfig unix tests)

ifeq ($(UNIX),true)

# libmagic doesn't have a pkg-config file, so we need to call the compiler to test it
HAVE_LIBMAGIC = $(shell echo '\#include <magic.h>' | $(CC) $(CFLAGS) -x c -w -c - -o .libmagic-tmp 2>/dev/null && echo true)
HAVE_LIBMAGIC = $(shell echo '\#include <magic.h>' | $(CC) $(CFLAGS) -x c -w -c - -o .libmagic-tmp 2>/dev/null && echo true)

# fltk doesn't have a pkg-config file but has fltk-config instead.
# Also, don't try looking for it if we already have NTK.
ifneq ($(HAVE_NTK),true)
HAVE_FLTK = $(shell which fltk-config 1>/dev/null 2>/dev/null && echo true)
endif

endif

# --------------------------------------------------------------
@@ -377,6 +386,14 @@ endif
# --------------------------------------------------------------
# Set libs stuff (part 3)

HAVE_ZYN_DEPS = $(shell pkg-config --exists fftw3 mxml zlib && echo true)
ifeq ($(HAVE_FLTK),true)
HAVE_ZYN_UI_DEPS = true
endif
ifeq ($(HAVE_NTK),true)
HAVE_ZYN_UI_DEPS = true
endif

ifeq ($(HAVE_DGL),true)
NATIVE_PLUGINS_LIBS += $(DGL_LIBS)
ifeq ($(HAVE_PROJECTM),true)
@@ -395,7 +412,11 @@ BASE_FLAGS += -DHAVE_ZYN_DEPS
NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs fftw3 mxml zlib)
ifeq ($(HAVE_ZYN_UI_DEPS),true)
BASE_FLAGS += -DHAVE_ZYN_UI_DEPS
ifeq ($(HAVE_NTK),true)
NATIVE_PLUGINS_LIBS += $(shell pkg-config --libs ntk_images ntk)
else
NATIVE_PLUGINS_LIBS += $(shell fltk-config --use-images --ldstaticflags)
endif
endif
endif



+ 9
- 2
source/native-plugins/Makefile View File

@@ -23,8 +23,15 @@ ifneq ($(MACOS),true)
ZYN_CXX_FLAGS += -DHAVE_SCHEDULER
endif
ifeq ($(HAVE_ZYN_UI_DEPS),true)
ifeq ($(HAVE_NTK),true)
FLUID = ntk-fluid
ZYN_CXX_FLAGS += -DNTK_GUI
ZYN_CXX_FLAGS += $(shell pkg-config --cflags ntk_images ntk)
else
FLUID = fluid
ZYN_CXX_FLAGS += -DFLTK_GUI
ZYN_CXX_FLAGS += $(shell fltk-config --use-images --cxxflags)
endif
endif
endif

@@ -162,11 +169,11 @@ $(MODULEDIR)/$(MODULENAME).a: $(OBJS)

zynaddsubfx/UI/%.cpp: zynaddsubfx/UI/%.fl
@echo "Generating $@/h"
@ntk-fluid -c -o zynaddsubfx/UI/$*.cpp -h zynaddsubfx/UI/$*.h $<
@$(FLUID) -c -o zynaddsubfx/UI/$*.cpp -h zynaddsubfx/UI/$*.h $<

zynaddsubfx/UI/%.h: zynaddsubfx/UI/%.fl
@echo "Generating $@/cpp"
@ntk-fluid -c -o zynaddsubfx/UI/$*.cpp -h zynaddsubfx/UI/$*.h $<
@$(FLUID) -c -o zynaddsubfx/UI/$*.cpp -h zynaddsubfx/UI/$*.h $<

# ----------------------------------------------------------------------------------------------------------------------------



+ 13
- 6
source/native-plugins/zynaddsubfx-synth.cpp View File

@@ -37,11 +37,12 @@
# undef override
# endif

# include "UI/common.H"
# include "UI/MasterUI.h"
# include <FL/Fl_Shared_Image.H>
# include <FL/Fl_Tiled_Image.H>
# include <FL/Fl_Theme.H>
# ifdef NTK_GUI
# include <FL/Fl_Theme.H>
# endif

# ifdef override_hack
# define override
@@ -57,19 +58,23 @@
using juce::FloatVectorOperations;

#ifdef WANT_ZYNADDSUBFX_UI
static Fl_Tiled_Image* gModuleBackdrop = nullptr;
static CarlaString gPixmapPath;
extern CarlaString gUiPixmapPath;
# ifdef NTK_GUI
static Fl_Tiled_Image* gModuleBackdrop = nullptr;
# endif

void set_module_parameters(Fl_Widget* o)
{
CARLA_SAFE_ASSERT_RETURN(gModuleBackdrop != nullptr,);

o->box(FL_DOWN_FRAME);
o->align(o->align() | FL_ALIGN_IMAGE_BACKDROP);
o->color(FL_BLACK);
o->labeltype(FL_SHADOW_LABEL);

# ifdef NTK_GUI
CARLA_SAFE_ASSERT_RETURN(gModuleBackdrop != nullptr,);
o->image(gModuleBackdrop);
# endif
}
#endif

@@ -446,6 +451,7 @@ protected:
initialized = true;
fl_register_images();

# ifdef NTK_GUI
Fl_Dial::default_style(Fl_Dial::PIXMAP_DIAL);

if (Fl_Shared_Image* const img = Fl_Shared_Image::get(gPixmapPath + "knob.png"))
@@ -454,7 +460,7 @@ protected:
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(gPixmapPath + "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);
@@ -462,6 +468,7 @@ protected:
Fl::foreground(255, 255, 255);

Fl_Theme::set("Cairo");
# endif
}

if (fUi == nullptr)


Loading…
Cancel
Save