From a7b3adf2690232c59bdc297b16476e2c29a88abb Mon Sep 17 00:00:00 2001 From: falkTX Date: Tue, 26 Feb 2013 23:10:20 +0000 Subject: [PATCH] Add dpl Makefile, update 3bandeq ui for it --- .../native/3bandeq/DistrhoUI3BandEQ.cpp | 13 ++--- .../native/3bandeq/DistrhoUI3BandEQ.hpp | 18 ++++--- source/backend/plugin/Makefile | 4 +- source/libs/Makefile | 7 ++- source/libs/distrho/DistrhoUIOpenGL.hpp | 4 +- source/libs/distrho/dgl/Image.hpp | 1 + source/libs/distrho/dgl/Makefile | 49 +++++++++++++++++++ source/libs/distrho/dgl/src/Image.cpp | 8 +++ source/libs/distrho/src/DistrhoUI.cpp | 6 --- source/libs/distrho/src/DistrhoUIInternal.hpp | 4 +- source/libs/distrho/src/DistrhoUIOpenGL.cpp | 1 + 11 files changed, 87 insertions(+), 28 deletions(-) create mode 100644 source/libs/distrho/dgl/Makefile diff --git a/source/backend/native/3bandeq/DistrhoUI3BandEQ.cpp b/source/backend/native/3bandeq/DistrhoUI3BandEQ.cpp index e75008a30..5a1f4491a 100644 --- a/source/backend/native/3bandeq/DistrhoUI3BandEQ.cpp +++ b/source/backend/native/3bandeq/DistrhoUI3BandEQ.cpp @@ -23,6 +23,8 @@ START_NAMESPACE_DISTRHO DistrhoUI3BandEQ::DistrhoUI3BandEQ() : OpenGLUI() { + Window* win = getParent(); + // background fImgBackground = Image(DistrhoArtwork3BandEQ::backgroundData, DistrhoArtwork3BandEQ::backgroundWidth, DistrhoArtwork3BandEQ::backgroundHeight, GL_BGR); @@ -32,7 +34,7 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ() Point sliderPosEnd(57, 43 + 160); // slider Low - fSliderLow = new ImageSlider(sliderImage); + fSliderLow = new ImageSlider(win, sliderImage); fSliderLow->setStartPos(sliderPosStart); fSliderLow->setEndPos(sliderPosEnd); fSliderLow->setRange(-24.0f, 24.0f); @@ -45,7 +47,6 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ() fSliderMid = new ImageSlider(*fSliderLow); fSliderMid->setStartPos(sliderPosStart); fSliderMid->setEndPos(sliderPosEnd); - fSliderMid->setCallback(this); // slider High sliderPosStart.setX(183); @@ -53,7 +54,6 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ() fSliderHigh = new ImageSlider(*fSliderLow); fSliderHigh->setStartPos(sliderPosStart); fSliderHigh->setEndPos(sliderPosEnd); - fSliderHigh->setCallback(this); // slider Master sliderPosStart.setX(287); @@ -61,14 +61,12 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ() fSliderMaster = new ImageSlider(*fSliderLow); fSliderMaster->setStartPos(sliderPosStart); fSliderMaster->setEndPos(sliderPosEnd); - fSliderMaster->setCallback(this); // knobs Image knobImage(DistrhoArtwork3BandEQ::knobData, DistrhoArtwork3BandEQ::knobWidth, DistrhoArtwork3BandEQ::knobHeight); - Point knobPos(66, 270); // knob Low-Mid - fKnobLowMid = new ImageKnob(knobImage); + fKnobLowMid = new ImageKnob(win, knobImage); fKnobLowMid->setPos(66, 270); fKnobLowMid->setRange(0.0f, 1000.0f); fKnobLowMid->setValue(220.0f); @@ -77,12 +75,11 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ() // knob Mid-High fKnobMidHigh = new ImageKnob(*fKnobLowMid); fKnobMidHigh->setPos(160, 270); - fKnobMidHigh->setCallback(this); // about button Image aboutImageNormal(DistrhoArtwork3BandEQ::aboutButtonNormalData, DistrhoArtwork3BandEQ::aboutButtonNormalWidth, DistrhoArtwork3BandEQ::aboutButtonNormalHeight); Image aboutImageHover(DistrhoArtwork3BandEQ::aboutButtonHoverData, DistrhoArtwork3BandEQ::aboutButtonHoverWidth, DistrhoArtwork3BandEQ::aboutButtonHoverHeight); - fButtonAbout = new ImageButton(aboutImageNormal, aboutImageHover, aboutImageHover); + fButtonAbout = new ImageButton(win, aboutImageNormal, aboutImageHover, aboutImageHover); fButtonAbout->setPos(264, 300); fButtonAbout->setCallback(this); } diff --git a/source/backend/native/3bandeq/DistrhoUI3BandEQ.hpp b/source/backend/native/3bandeq/DistrhoUI3BandEQ.hpp index 5d8b21d81..b96ff700e 100644 --- a/source/backend/native/3bandeq/DistrhoUI3BandEQ.hpp +++ b/source/backend/native/3bandeq/DistrhoUI3BandEQ.hpp @@ -39,25 +39,29 @@ public: DistrhoUI3BandEQ(); ~DistrhoUI3BandEQ(); - // --------------------------------------------- protected: - + // --------------------------------------------- // Information - int d_width() + + unsigned int d_width() const { - return (int)DistrhoArtwork3BandEQ::backgroundWidth; + return DistrhoArtwork3BandEQ::backgroundWidth; } - int d_height() + unsigned int d_height() const { - return (int)DistrhoArtwork3BandEQ::backgroundHeight; + return DistrhoArtwork3BandEQ::backgroundHeight; } + // --------------------------------------------- // DSP Callbacks + void d_parameterChanged(uint32_t index, float value); void d_programChanged(uint32_t index); - // Extended Callbacks + // --------------------------------------------- + // Widget Callbacks + void imageButtonClicked(ImageButton* button, int); void imageKnobDragStarted(ImageKnob* knob); void imageKnobDragFinished(ImageKnob* knob); diff --git a/source/backend/plugin/Makefile b/source/backend/plugin/Makefile index 7c7c0f919..6b66652ea 100644 --- a/source/backend/plugin/Makefile +++ b/source/backend/plugin/Makefile @@ -58,8 +58,8 @@ debug: %.cpp.o: %.cpp ../CarlaEngine.hpp ../CarlaPlugin.hpp CarlaPluginInternal.hpp CarlaPluginThread.hpp $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ -$(SHARED): $(OBJS) $(LIBS) +$(SHARED): $(OBJS) $(CXX) $^ -shared $(LINK_FLAGS) -o $@ -$(STATIC): $(OBJS) $(LIBS) +$(STATIC): $(OBJS) $(AR) rs $@ $^ diff --git a/source/libs/Makefile b/source/libs/Makefile index 7aa11d6e1..b0cebd751 100644 --- a/source/libs/Makefile +++ b/source/libs/Makefile @@ -1,6 +1,6 @@ #!/usr/bin/make -f # Makefile for carla libs # -# ----------------------------------------- # +# ----------------------- # # Created by falkTX # @@ -8,6 +8,11 @@ all: # -------------------------------------------------------------- +dgl.a: + $(MAKE) -C distrho/dgl + +# -------------------------------------------------------------- + jackbridge-win32.dll: $(MAKE) -C jackbridge win32 diff --git a/source/libs/distrho/DistrhoUIOpenGL.hpp b/source/libs/distrho/DistrhoUIOpenGL.hpp index d0ebeac91..e0f95df65 100644 --- a/source/libs/distrho/DistrhoUIOpenGL.hpp +++ b/source/libs/distrho/DistrhoUIOpenGL.hpp @@ -21,6 +21,8 @@ #include "dgl/Widget.hpp" +USE_NAMESPACE_DGL + START_NAMESPACE_DISTRHO // ------------------------------------------------- @@ -57,7 +59,7 @@ protected: // --------------------------------------------- // UI Callbacks - virtual void d_uiIdle() = 0; + virtual void d_uiIdle() {} private: friend class UIInternal; diff --git a/source/libs/distrho/dgl/Image.hpp b/source/libs/distrho/dgl/Image.hpp index 51f4941f8..5cd29ecd1 100644 --- a/source/libs/distrho/dgl/Image.hpp +++ b/source/libs/distrho/dgl/Image.hpp @@ -27,6 +27,7 @@ class Image { public: Image(); + Image(const char* rawData, int width, int height, GLenum format = GL_BGRA, GLenum type = GL_UNSIGNED_BYTE); Image(const char* rawData, const Size& size, GLenum format = GL_BGRA, GLenum type = GL_UNSIGNED_BYTE); Image(const Image& image); diff --git a/source/libs/distrho/dgl/Makefile b/source/libs/distrho/dgl/Makefile new file mode 100644 index 000000000..2262c4ce4 --- /dev/null +++ b/source/libs/distrho/dgl/Makefile @@ -0,0 +1,49 @@ +#!/usr/bin/make -f +# Makefile for dgl # +# ---------------- # +# Created by falkTX +# + +include ../../../Makefile.mk + +# -------------------------------------------------------------- + +BUILD_CXX_FLAGS += -fvisibility=hidden -fPIC +BUILD_CXX_FLAGS += -I. + +OBJS = \ + src/App.cpp.o \ + src/Image.cpp.o \ + src/ImageAboutWindow.cpp.o \ + src/ImageButton.cpp.o \ + src/ImageKnob.cpp.o \ + src/ImageSlider.cpp.o \ + src/Geometry.cpp.o \ + src/Widget.cpp.o \ + src/Window.cpp.o + +STATIC = ../../dgl.a + +# -------------------------------------------------------------- + +all: $(STATIC) + +clean: + rm -f $(OBJS) $(SHARED) $(STATIC) + +debug: + $(MAKE) DEBUG=true + +# -------------------------------------------------------------- + +%.cpp.o: %.cpp + $(CXX) $< $(BUILD_CXX_FLAGS) -c -o $@ + +$(STATIC): $(OBJS) + $(AR) rs $@ $^ + +../../dgl.dll: $(OBJS) + $(CXX) $^ -shared $(LINK_FLAGS) -lopengl32 -lgdi32 -o $@ + +../../dgl.so: $(OBJS) + $(CXX) $^ -shared $(LINK_FLAGS) -lX11 -lGL -lGLU -o $@ diff --git a/source/libs/distrho/dgl/src/Image.cpp b/source/libs/distrho/dgl/src/Image.cpp index 37239d448..52417e4e4 100644 --- a/source/libs/distrho/dgl/src/Image.cpp +++ b/source/libs/distrho/dgl/src/Image.cpp @@ -28,6 +28,14 @@ Image::Image() { } +Image::Image(const char* rawData, int width, int height, GLenum format, GLenum type) + : fRawData(rawData), + fSize(width, height), + fFormat(format), + fType(type) +{ +} + Image::Image(const char* rawData, const Size& size, GLenum format, GLenum type) : fRawData(rawData), fSize(size), diff --git a/source/libs/distrho/src/DistrhoUI.cpp b/source/libs/distrho/src/DistrhoUI.cpp index 1d7041098..53409512f 100644 --- a/source/libs/distrho/src/DistrhoUI.cpp +++ b/source/libs/distrho/src/DistrhoUI.cpp @@ -36,12 +36,6 @@ UI::UI() # endif pData->parameterOffset += 1; // sample-rate #endif - -#ifdef DISTRHO_UI_QT4 - pData->ui = (Qt4UI*)this; -#else - pData->ui = (OpenGLUI*)this; -#endif } UI::~UI() diff --git a/source/libs/distrho/src/DistrhoUIInternal.hpp b/source/libs/distrho/src/DistrhoUIInternal.hpp index a0bd5f0d8..8c74cba38 100644 --- a/source/libs/distrho/src/DistrhoUIInternal.hpp +++ b/source/libs/distrho/src/DistrhoUIInternal.hpp @@ -164,8 +164,6 @@ public: #ifdef DISTRHO_UI_QT4 createWindow(winId); -#else - d_lastUiParent = nullptr; #endif } @@ -316,7 +314,7 @@ public: Window* createWindow(intptr_t parent) { Window* window = new Window(&glApp, parent); - d_lastParent = window; + d_lastUiParent = window; return window; } #endif diff --git a/source/libs/distrho/src/DistrhoUIOpenGL.cpp b/source/libs/distrho/src/DistrhoUIOpenGL.cpp index a3d3104aa..9238ab150 100644 --- a/source/libs/distrho/src/DistrhoUIOpenGL.cpp +++ b/source/libs/distrho/src/DistrhoUIOpenGL.cpp @@ -30,6 +30,7 @@ OpenGLUI::OpenGLUI() : UI(), Widget(d_lastParent) { + d_lastParent = nullptr; } OpenGLUI::~OpenGLUI()