Browse Source

Rework macros for DGL

tags/1.9.4
falkTX 11 years ago
parent
commit
8b959ea517
25 changed files with 217 additions and 175 deletions
  1. +1
    -1
      source/backend/native/3bandeq/DistrhoPluginInfo.h
  2. +86
    -90
      source/backend/native/3bandeq/DistrhoUI3BandEQ.cpp
  3. +19
    -14
      source/backend/native/3bandeq/DistrhoUI3BandEQ.hpp
  4. +3
    -3
      source/backend/native/distrho-3bandeq.cpp
  5. +2
    -2
      source/libs/distrho/dgl/App.hpp
  6. +42
    -2
      source/libs/distrho/dgl/Base.hpp
  7. +2
    -2
      source/libs/distrho/dgl/Geometry.hpp
  8. +2
    -2
      source/libs/distrho/dgl/Image.hpp
  9. +2
    -2
      source/libs/distrho/dgl/ImageAboutWindow.hpp
  10. +2
    -2
      source/libs/distrho/dgl/ImageButton.hpp
  11. +2
    -2
      source/libs/distrho/dgl/ImageKnob.hpp
  12. +2
    -2
      source/libs/distrho/dgl/ImageSlider.hpp
  13. +2
    -2
      source/libs/distrho/dgl/Widget.hpp
  14. +3
    -3
      source/libs/distrho/dgl/Window.hpp
  15. +3
    -3
      source/libs/distrho/dgl/src/App.cpp
  16. +2
    -2
      source/libs/distrho/dgl/src/AppPrivate.hpp
  17. +2
    -2
      source/libs/distrho/dgl/src/Geometry.cpp
  18. +2
    -2
      source/libs/distrho/dgl/src/Image.cpp
  19. +3
    -3
      source/libs/distrho/dgl/src/ImageAboutWindow.cpp
  20. +3
    -3
      source/libs/distrho/dgl/src/ImageButton.cpp
  21. +3
    -3
      source/libs/distrho/dgl/src/ImageKnob.cpp
  22. +3
    -3
      source/libs/distrho/dgl/src/ImageSlider.cpp
  23. +2
    -2
      source/libs/distrho/dgl/src/Widget.cpp
  24. +23
    -22
      source/libs/distrho/dgl/src/Window.cpp
  25. +1
    -1
      source/libs/distrho/src/DistrhoDefines.h

+ 1
- 1
source/backend/native/3bandeq/DistrhoPluginInfo.h View File

@@ -19,7 +19,7 @@

#define DISTRHO_PLUGIN_NAME "3 Band EQ"

#define DISTRHO_PLUGIN_HAS_UI 0
#define DISTRHO_PLUGIN_HAS_UI 1
#define DISTRHO_PLUGIN_IS_SYNTH 0

#define DISTRHO_PLUGIN_NUM_INPUTS 2


+ 86
- 90
source/backend/native/3bandeq/DistrhoUI3BandEQ.cpp View File

@@ -21,81 +21,81 @@ START_NAMESPACE_DISTRHO
// -------------------------------------------------

DistrhoUI3BandEQ::DistrhoUI3BandEQ()
: OpenGLExtUI()
: OpenGLUI()
{
// background
Image bgImage(DistrhoArtwork3BandEQ::backgroundData, DistrhoArtwork3BandEQ::backgroundWidth, DistrhoArtwork3BandEQ::backgroundHeight, GL_BGR);
setBackgroundImage(bgImage);
fImgBackground = Image(DistrhoArtwork3BandEQ::backgroundData, DistrhoArtwork3BandEQ::backgroundWidth, DistrhoArtwork3BandEQ::backgroundHeight, GL_BGR);

// sliders
Image sliderImage(DistrhoArtwork3BandEQ::sliderData, DistrhoArtwork3BandEQ::sliderWidth, DistrhoArtwork3BandEQ::sliderHeight);
Point sliderPosStart(57, 43);
Point sliderPosEnd(57, 43 + 160);
Point<int> sliderPosStart(57, 43);
Point<int> sliderPosEnd(57, 43 + 160);

// slider Low
sliderLow = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd);
sliderLow->setRange(-24.0f, 24.0f);
sliderLow->setValue(0.0f);
addImageSlider(sliderLow);
fSliderLow = new ImageSlider(sliderImage);
fSliderLow->setStartPos(sliderPosStart);
fSliderLow->setEndPos(sliderPosEnd);
fSliderLow->setRange(-24.0f, 24.0f);
fSliderLow->setValue(0.0f);
fSliderLow->setCallback(this);

// slider Mid
sliderPosStart.setX(120);
sliderPosEnd.setX(120);
sliderMid = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd);
sliderMid->setRange(-24.0f, 24.0f);
sliderMid->setValue(0.0f);
addImageSlider(sliderMid);
fSliderMid = new ImageSlider(*fSliderLow);
fSliderMid->setStartPos(sliderPosStart);
fSliderMid->setEndPos(sliderPosEnd);
fSliderMid->setCallback(this);

// slider High
sliderPosStart.setX(183);
sliderPosEnd.setX(183);
sliderHigh = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd);
sliderHigh->setRange(-24.0f, 24.0f);
sliderHigh->setValue(0.0f);
addImageSlider(sliderHigh);
fSliderHigh = new ImageSlider(*fSliderLow);
fSliderHigh->setStartPos(sliderPosStart);
fSliderHigh->setEndPos(sliderPosEnd);
fSliderHigh->setCallback(this);

// slider Master
sliderPosStart.setX(287);
sliderPosEnd.setX(287);
sliderMaster = new ImageSlider(sliderImage, sliderPosStart, sliderPosEnd);
sliderMaster->setRange(-24.0f, 24.0f);
sliderMaster->setValue(0.0f);
addImageSlider(sliderMaster);
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
knobLowMid = new ImageKnob(knobImage, knobPos);
knobLowMid->setRange(0.0f, 1000.0f);
knobLowMid->setValue(220.0f);
addImageKnob(knobLowMid);
fKnobLowMid = new ImageKnob(knobImage);
fKnobLowMid->setPos(66, 270);
fKnobLowMid->setRange(0.0f, 1000.0f);
fKnobLowMid->setValue(220.0f);
fKnobLowMid->setCallback(this);

// knob Mid-High
knobPos.setX(160);
knobMidHigh = new ImageKnob(knobImage, knobPos);
knobMidHigh->setRange(1000.0f, 20000.0f);
knobMidHigh->setValue(2000.0f);
addImageKnob(knobMidHigh);
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);
Point aboutPos(264, 300);
buttonAbout = new ImageButton(aboutImageNormal, aboutImageHover, aboutImageHover, aboutPos);
addImageButton(buttonAbout);
fButtonAbout = new ImageButton(aboutImageNormal, aboutImageHover, aboutImageHover);
fButtonAbout->setPos(264, 300);
fButtonAbout->setCallback(this);
}

DistrhoUI3BandEQ::~DistrhoUI3BandEQ()
{
delete sliderLow;
delete sliderMid;
delete sliderHigh;
delete sliderMaster;
delete knobLowMid;
delete knobMidHigh;
delete buttonAbout;
delete fSliderLow;
delete fSliderMid;
delete fSliderHigh;
delete fSliderMaster;
delete fKnobLowMid;
delete fKnobMidHigh;
delete fButtonAbout;
}

// -------------------------------------------------
@@ -106,26 +106,24 @@ void DistrhoUI3BandEQ::d_parameterChanged(uint32_t index, float value)
switch (index)
{
case DistrhoPlugin3BandEQ::paramLow:
sliderLow->setValue(value);
fSliderLow->setValue(value);
break;
case DistrhoPlugin3BandEQ::paramMid:
sliderMid->setValue(value);
fSliderMid->setValue(value);
break;
case DistrhoPlugin3BandEQ::paramHigh:
sliderHigh->setValue(value);
fSliderHigh->setValue(value);
break;
case DistrhoPlugin3BandEQ::paramMaster:
sliderMaster->setValue(value);
fSliderMaster->setValue(value);
break;
case DistrhoPlugin3BandEQ::paramLowMidFreq:
knobLowMid->setValue(value);
fKnobLowMid->setValue(value);
break;
case DistrhoPlugin3BandEQ::paramMidHighFreq:
knobMidHigh->setValue(value);
fKnobMidHigh->setValue(value);
break;
}

d_uiRepaint();
}

void DistrhoUI3BandEQ::d_programChanged(uint32_t index)
@@ -134,86 +132,84 @@ void DistrhoUI3BandEQ::d_programChanged(uint32_t index)
return;

// Default values
sliderLow->setValue(0.0f);
sliderMid->setValue(0.0f);
sliderHigh->setValue(0.0f);
sliderMaster->setValue(0.0f);
knobLowMid->setValue(220.0f);
knobMidHigh->setValue(2000.0f);

d_uiRepaint();
fSliderLow->setValue(0.0f);
fSliderMid->setValue(0.0f);
fSliderHigh->setValue(0.0f);
fSliderMaster->setValue(0.0f);
fKnobLowMid->setValue(220.0f);
fKnobMidHigh->setValue(2000.0f);
}

// -------------------------------------------------
// Extended Callbacks

void DistrhoUI3BandEQ::imageButtonClicked(ImageButton* button)
void DistrhoUI3BandEQ::imageButtonClicked(ImageButton* button, int)
{
if (button != buttonAbout)
if (button != fButtonAbout)
return;

Image imageAbout(DistrhoArtwork3BandEQ::aboutData, DistrhoArtwork3BandEQ::aboutWidth, DistrhoArtwork3BandEQ::aboutHeight, GL_BGRA);
showImageModalDialog(imageAbout, "About");
ImageAboutWindow aboutWindow(getApp(), getParent(), imageAbout);
aboutWindow.exec();
}

void DistrhoUI3BandEQ::imageKnobDragStarted(ImageKnob* knob)
{
if (knob == knobLowMid)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramLowMidFreq, true);
else if (knob == knobMidHigh)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramMidHighFreq, true);
if (knob == fKnobLowMid)
d_editParameter(DistrhoPlugin3BandEQ::paramLowMidFreq, true);
else if (knob == fKnobMidHigh)
d_editParameter(DistrhoPlugin3BandEQ::paramMidHighFreq, true);
}

void DistrhoUI3BandEQ::imageKnobDragFinished(ImageKnob* knob)
{
if (knob == knobLowMid)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramLowMidFreq, false);
else if (knob == knobMidHigh)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramMidHighFreq, false);
if (knob == fKnobLowMid)
d_editParameter(DistrhoPlugin3BandEQ::paramLowMidFreq, false);
else if (knob == fKnobMidHigh)
d_editParameter(DistrhoPlugin3BandEQ::paramMidHighFreq, false);
}


void DistrhoUI3BandEQ::imageKnobValueChanged(ImageKnob* knob, float value)
{
if (knob == knobLowMid)
if (knob == fKnobLowMid)
d_setParameterValue(DistrhoPlugin3BandEQ::paramLowMidFreq, value);
else if (knob == knobMidHigh)
else if (knob == fKnobMidHigh)
d_setParameterValue(DistrhoPlugin3BandEQ::paramMidHighFreq, value);
}

void DistrhoUI3BandEQ::imageSliderDragStarted(ImageSlider* slider)
{
if (slider == sliderLow)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramLow, true);
else if (slider == sliderMid)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramMid, true);
else if (slider == sliderHigh)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramHigh, true);
else if (slider == sliderMaster)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramMaster, true);
if (slider == fSliderLow)
d_editParameter(DistrhoPlugin3BandEQ::paramLow, true);
else if (slider == fSliderMid)
d_editParameter(DistrhoPlugin3BandEQ::paramMid, true);
else if (slider == fSliderHigh)
d_editParameter(DistrhoPlugin3BandEQ::paramHigh, true);
else if (slider == fSliderMaster)
d_editParameter(DistrhoPlugin3BandEQ::paramMaster, true);
}

void DistrhoUI3BandEQ::imageSliderDragFinished(ImageSlider* slider)
{
if (slider == sliderLow)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramLow, false);
else if (slider == sliderMid)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramMid, false);
else if (slider == sliderHigh)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramHigh, false);
else if (slider == sliderMaster)
d_uiEditParameter(DistrhoPlugin3BandEQ::paramMaster, false);
if (slider == fSliderLow)
d_editParameter(DistrhoPlugin3BandEQ::paramLow, false);
else if (slider == fSliderMid)
d_editParameter(DistrhoPlugin3BandEQ::paramMid, false);
else if (slider == fSliderHigh)
d_editParameter(DistrhoPlugin3BandEQ::paramHigh, false);
else if (slider == fSliderMaster)
d_editParameter(DistrhoPlugin3BandEQ::paramMaster, false);
}

void DistrhoUI3BandEQ::imageSliderValueChanged(ImageSlider* slider, float value)
{
if (slider == sliderLow)
if (slider == fSliderLow)
d_setParameterValue(DistrhoPlugin3BandEQ::paramLow, value);
else if (slider == sliderMid)
else if (slider == fSliderMid)
d_setParameterValue(DistrhoPlugin3BandEQ::paramMid, value);
else if (slider == sliderHigh)
else if (slider == fSliderHigh)
d_setParameterValue(DistrhoPlugin3BandEQ::paramHigh, value);
else if (slider == sliderMaster)
else if (slider == fSliderMaster)
d_setParameterValue(DistrhoPlugin3BandEQ::paramMaster, value);
}



+ 19
- 14
source/backend/native/3bandeq/DistrhoUI3BandEQ.hpp View File

@@ -17,7 +17,11 @@
#ifndef __DISTRHO_UI_3BANDEQ_HPP__
#define __DISTRHO_UI_3BANDEQ_HPP__

#include "DistrhoUIOpenGLExt.h"
#include "DistrhoUIOpenGL.hpp"
#include "dgl/ImageAboutWindow.hpp"
#include "dgl/ImageButton.hpp"
#include "dgl/ImageKnob.hpp"
#include "dgl/ImageSlider.hpp"

#include "DistrhoArtwork3BandEQ.hpp"
#include "DistrhoPlugin3BandEQ.hpp"
@@ -26,7 +30,10 @@ START_NAMESPACE_DISTRHO

// -------------------------------------------------

class DistrhoUI3BandEQ : public OpenGLExtUI
class DistrhoUI3BandEQ : public OpenGLUI,
public ImageButton::Callback,
public ImageKnob::Callback,
public ImageSlider::Callback
{
public:
DistrhoUI3BandEQ();
@@ -51,7 +58,7 @@ protected:
void d_programChanged(uint32_t index);

// Extended Callbacks
void imageButtonClicked(ImageButton* button);
void imageButtonClicked(ImageButton* button, int);
void imageKnobDragStarted(ImageKnob* knob);
void imageKnobDragFinished(ImageKnob* knob);
void imageKnobValueChanged(ImageKnob* knob, float value);
@@ -59,18 +66,16 @@ protected:
void imageSliderDragFinished(ImageSlider* slider);
void imageSliderValueChanged(ImageSlider* slider, float value);

#ifdef QTCREATOR_TEST
void d_stateChanged(const char*, const char*) {}
#endif

private:
ImageSlider* sliderLow;
ImageSlider* sliderMid;
ImageSlider* sliderHigh;
ImageSlider* sliderMaster;
ImageKnob* knobLowMid;
ImageKnob* knobMidHigh;
ImageButton* buttonAbout;
Image fImgBackground;

ImageSlider* fSliderLow;
ImageSlider* fSliderMid;
ImageSlider* fSliderHigh;
ImageSlider* fSliderMaster;
ImageKnob* fKnobLowMid;
ImageKnob* fKnobMidHigh;
ImageButton* fButtonAbout;
};

// -------------------------------------------------


+ 3
- 3
source/backend/native/distrho-3bandeq.cpp View File

@@ -18,9 +18,9 @@
#include "CarlaNative.hpp"

// Plugin Code
//#include "3bandeq/DistrhoArtwork3BandEQ.cpp"
#include "3bandeq/DistrhoArtwork3BandEQ.cpp"
#include "3bandeq/DistrhoPlugin3BandEQ.cpp"
//#include "3bandeq/DistrhoUI3BandEQ.cpp"
#include "3bandeq/DistrhoUI3BandEQ.cpp"

// Carla DISTRHO Plugin
#include "distrho/DistrhoPluginCarla.cpp"
@@ -31,7 +31,7 @@ START_NAMESPACE_DISTRHO

static const PluginDescriptor tBandEqDesc = {
/* category */ ::PLUGIN_CATEGORY_EQ,
/* hints */ static_cast<PluginHints>(::PLUGIN_IS_RTSAFE /*| ::PLUGIN_HAS_GUI*/),
/* hints */ static_cast<PluginHints>(::PLUGIN_IS_RTSAFE | ::PLUGIN_HAS_GUI),
/* audioIns */ DISTRHO_PLUGIN_NUM_INPUTS,
/* audioOuts */ DISTRHO_PLUGIN_NUM_OUTPUTS,
/* midiIns */ 0,


+ 2
- 2
source/libs/distrho/dgl/App.hpp View File

@@ -19,7 +19,7 @@

#include "Base.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -40,6 +40,6 @@ private:

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

#endif // __DGL_APP_HPP__

+ 42
- 2
source/libs/distrho/dgl/Base.hpp View File

@@ -17,9 +17,29 @@
#ifndef __DGL_BASE_HPP__
#define __DGL_BASE_HPP__

#include "../src/DistrhoDefines.h"
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define DGL_OS_WINDOWS 1
#elif defined(__APPLE__)
# define DGL_OS_MAC 1
#elif defined(__HAIKU__)
# define DGL_OS_HAIKU 1
#elif defined(__linux__)
# define DGL_OS_LINUX 1
#endif

#define DGL_NAMESPACE DGL

#define START_NAMESPACE_DGL namespace DGL_NAMESPACE {
#define END_NAMESPACE_DGL }
#define USE_NAMESPACE_DGL using namespace DGL_NAMESPACE;

#if DGL_OS_WINDOWS
# include <windows.h>
#else
# include <unistd.h>
#endif

#if DISTRHO_OS_MAC
#if DGL_OS_MAC
# include <OpenGL/glu.h>
#else
# include <GL/glu.h>
@@ -76,4 +96,24 @@ enum Modifier {
MODIFIER_SUPER = 1 << 3 /**< Mod4/Command/Windows key */
};

static inline
void dgl_sleep(unsigned int secs)
{
#ifdef DGL_OS_WINDOWS
Sleep(secs * 1000);
#else
sleep(secs);
#endif
}

static inline
void dgl_msleep(unsigned int msecs)
{
#ifdef DGL_OS_WINDOWS
Sleep(msecs);
#else
usleep(msecs * 1000);
#endif
}

#endif // __DGL_BASE_HPP__

+ 2
- 2
source/libs/distrho/dgl/Geometry.hpp View File

@@ -19,7 +19,7 @@

#include "Base.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -128,6 +128,6 @@ private:

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

#endif // __DGL_GEOMETRY_HPP__

+ 2
- 2
source/libs/distrho/dgl/Image.hpp View File

@@ -19,7 +19,7 @@

#include "Geometry.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -57,6 +57,6 @@ private:

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

#endif // __DGL_IMAGE_HPP__

+ 2
- 2
source/libs/distrho/dgl/ImageAboutWindow.hpp View File

@@ -23,7 +23,7 @@

#include <cstdint>

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -44,6 +44,6 @@ private:

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

#endif // __DGL_IMAGE_ABOUT_WINDOW_HPP__

+ 2
- 2
source/libs/distrho/dgl/ImageButton.hpp View File

@@ -20,7 +20,7 @@
#include "Image.hpp"
#include "Widget.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -57,6 +57,6 @@ private:

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

#endif // __DGL_IMAGE_BUTTON_HPP__

+ 2
- 2
source/libs/distrho/dgl/ImageKnob.hpp View File

@@ -20,7 +20,7 @@
#include "Image.hpp"
#include "Widget.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -78,6 +78,6 @@ private:

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

#endif // __DGL_IMAGE_KNOB_HPP__

+ 2
- 2
source/libs/distrho/dgl/ImageSlider.hpp View File

@@ -20,7 +20,7 @@
#include "Image.hpp"
#include "Widget.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -75,6 +75,6 @@ private:

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

#endif // __DGL_IMAGE_SLIDER_HPP__

+ 2
- 2
source/libs/distrho/dgl/Widget.hpp View File

@@ -21,7 +21,7 @@

#include <cstdint>

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -96,6 +96,6 @@ private:

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

#endif // __DGL_WIDGET_HPP__

+ 3
- 3
source/libs/distrho/dgl/Window.hpp View File

@@ -17,9 +17,9 @@
#ifndef __DGL_WINDOW_HPP__
#define __DGL_WINDOW_HPP__

#include "Geometry.hpp"
#include "Base.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -68,6 +68,6 @@ private:

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

#endif // __DGL_WINDOW_HPP__

+ 3
- 3
source/libs/distrho/dgl/src/App.cpp View File

@@ -19,7 +19,7 @@
#include "../Window.hpp"
#include "../../DistrhoUtils.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -47,10 +47,10 @@ void App::exec()
while (kPrivate->fDoLoop)
{
idle();
d_msleep(10);
dgl_msleep(10);
}
}

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

+ 2
- 2
source/libs/distrho/dgl/src/AppPrivate.hpp View File

@@ -21,7 +21,7 @@

#include <list>

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -77,6 +77,6 @@ private:

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

#endif // __APP_PRIVATE_HPP__

+ 2
- 2
source/libs/distrho/dgl/src/Geometry.cpp View File

@@ -16,7 +16,7 @@

#include "../Geometry.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------
// Point
@@ -412,5 +412,5 @@ template class Rectangle<double>;

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL


+ 2
- 2
source/libs/distrho/dgl/src/Image.cpp View File

@@ -16,7 +16,7 @@

#include "../Image.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -117,4 +117,4 @@ Image& Image::operator=(const Image& image)

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

+ 3
- 3
source/libs/distrho/dgl/src/ImageAboutWindow.cpp View File

@@ -16,7 +16,7 @@

#include "../ImageAboutWindow.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -25,7 +25,7 @@ ImageAboutWindow::ImageAboutWindow(App* app, Window* parent, const Image& image)
Widget(this),
fImgBackground(image)
{
#if DISTRHO_OS_WINDOWS
#if DGL_OS_WINDOWS
// FIXME
Window::setSize(image.getWidth(), image.getHeight()+1);
#else
@@ -64,4 +64,4 @@ bool ImageAboutWindow::onKeyboard(bool press, uint32_t key)

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

+ 3
- 3
source/libs/distrho/dgl/src/ImageButton.cpp View File

@@ -18,7 +18,7 @@

#include <cassert>

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -54,7 +54,7 @@ ImageButton::ImageButton(const ImageButton& imageButton)
fImageDown(imageButton.fImageDown),
fCurImage(&fImageNormal),
fCurButton(-1),
fCallback(nullptr)
fCallback(imageButton.fCallback)
{
assert(fImageNormal.getSize() == fImageHover.getSize() && fImageHover.getSize() == fImageDown.getSize());

@@ -145,4 +145,4 @@ bool ImageButton::onMotion(int x, int y)

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

+ 3
- 3
source/libs/distrho/dgl/src/ImageKnob.cpp View File

@@ -16,7 +16,7 @@

#include "../ImageKnob.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -49,7 +49,7 @@ ImageKnob::ImageKnob(const ImageKnob& imageKnob)
fDragging(false),
fLastX(0),
fLastY(0),
fCallback(nullptr),
fCallback(imageKnob.fCallback),
fIsImgVertical(imageKnob.fIsImgVertical),
fImgLayerSize(imageKnob.fImgLayerSize),
fImgLayerCount(imageKnob.fImgLayerCount),
@@ -203,4 +203,4 @@ bool ImageKnob::onMotion(int x, int y)

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

+ 3
- 3
source/libs/distrho/dgl/src/ImageSlider.cpp View File

@@ -16,7 +16,7 @@

#include "../ImageSlider.hpp"

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------

@@ -43,7 +43,7 @@ ImageSlider::ImageSlider(const ImageSlider& imageSlider)
fDragging(false),
fStartedX(0),
fStartedY(0),
fCallback(nullptr),
fCallback(imageSlider.fCallback),
fStartPos(imageSlider.fStartPos),
fEndPos(imageSlider.fEndPos),
fSliderArea(imageSlider.fSliderArea)
@@ -253,4 +253,4 @@ void ImageSlider::_recheckArea()

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

+ 2
- 2
source/libs/distrho/dgl/src/Widget.cpp View File

@@ -20,7 +20,7 @@

#include <cstdio>

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------
// Widget
@@ -228,4 +228,4 @@ void Widget::onClose()

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

+ 23
- 22
source/libs/distrho/dgl/src/Window.cpp View File

@@ -18,25 +18,26 @@

#include "../Widget.hpp"
#include "../Window.hpp"
#include "../../DistrhoUtils.hpp"

#if DISTRHO_OS_WINDOWS
#if DGL_OS_WINDOWS
# include "pugl/pugl_win.cpp"
#elif DISTRHO_OS_MAC
#elif DGL_OS_MAC
# include "pugl/pugl_osx.m"
#elif DISTRHO_OS_LINUX
#elif DGL_OS_LINUX
# include "pugl/pugl_x11.c"
#else
# error Unsupported platform!
#endif

#include <cassert>

#define FOR_EACH_WIDGET(it) \
for (auto it = fWidgets.begin(); it != fWidgets.end(); ++it)

#define FOR_EACH_WIDGET_INV(rit) \
for (auto rit = fWidgets.rbegin(); rit != fWidgets.rend(); ++rit)

START_NAMESPACE_DISTRHO
START_NAMESPACE_DGL

// -------------------------------------------------
// Window Private
@@ -54,9 +55,9 @@ public:
fVisible(false),
fClosed(false),
fResizable(false),
#if DISTRHO_OS_WINDOWS
#if DGL_OS_WINDOWS
hwnd(0)
#elif DISTRHO_OS_LINUX
#elif DGL_OS_LINUX
xDisplay(nullptr),
xWindow(0)
#else
@@ -84,9 +85,9 @@ public:

PuglInternals* impl = kView->impl;

#if DISTRHO_OS_WINDOWS
#if DGL_OS_WINDOWS
hwnd = impl->hwnd;
#elif DISTRHO_OS_LINUX
#elif DGL_OS_LINUX
xDisplay = impl->display;
xWindow = impl->win;

@@ -121,7 +122,7 @@ public:
{
fParent->fChildFocus = this;

#if DISTRHO_OS_WINDOWS
#if DGL_OS_WINDOWS
// Center this window
PuglInternals* parentImpl = fParent->kView->impl;

@@ -149,7 +150,7 @@ public:
if (fParent != nullptr)
fParent->idle();

d_msleep(10);
dgl_msleep(10);
}

fClosed = true;
@@ -162,11 +163,11 @@ public:

void focus()
{
#if DISTRHO_OS_WINDOWS
#if DGL_OS_WINDOWS
SetForegroundWindow(hwnd);
SetActiveWindow(hwnd);
SetFocus(hwnd);
#elif DISTRHO_OS_LINUX
#elif DGL_OS_LINUX
XRaiseWindow(xDisplay, xWindow);
XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime);
XFlush(xDisplay);
@@ -205,7 +206,7 @@ public:

fVisible = yesNo;

#if DISTRHO_OS_WINDOWS
#if DGL_OS_WINDOWS
if (yesNo)
{
ShowWindow(hwnd, WS_VISIBLE);
@@ -218,7 +219,7 @@ public:
}

UpdateWindow(hwnd);
#elif DISTRHO_OS_LINUX
#elif DGL_OS_LINUX
if (yesNo)
XMapRaised(xDisplay, xWindow);
else
@@ -235,7 +236,7 @@ public:

void setSize(unsigned int width, unsigned int height)
{
#if DISTRHO_OS_WINDOWS
#if DGL_OS_WINDOWS
int winFlags = WS_POPUPWINDOW | WS_CAPTION;

if (fResizable)
@@ -246,7 +247,7 @@ public:

SetWindowPos(hwnd, 0, 0, 0, wr.right-wr.left, wr.bottom-wr.top, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOOWNERZORDER|SWP_NOZORDER);
UpdateWindow(hwnd);
#elif DISTRHO_OS_LINUX
#elif DGL_OS_LINUX
XSizeHints sizeHints;
memset(&sizeHints, 0, sizeof(sizeHints));

@@ -264,9 +265,9 @@ public:

void setWindowTitle(const char* title)
{
#if DISTRHO_OS_WINDOWS
#if DGL_OS_WINDOWS
SetWindowTextA(hwnd, title);
#elif DISTRHO_OS_LINUX
#elif DGL_OS_LINUX
XStoreName(xDisplay, xWindow, title);
XFlush(xDisplay);
#endif
@@ -429,9 +430,9 @@ private:

std::list<Widget*> fWidgets;

#if DISTRHO_OS_WINDOWS
#if DGL_OS_WINDOWS
HWND hwnd;
#elif DISTRHO_OS_LINUX
#elif DGL_OS_LINUX
Display* xDisplay;
::Window xWindow;
#else
@@ -569,4 +570,4 @@ void Window::removeWidget(Widget* widget)

// -------------------------------------------------

END_NAMESPACE_DISTRHO
END_NAMESPACE_DGL

+ 1
- 1
source/libs/distrho/src/DistrhoDefines.h View File

@@ -51,7 +51,7 @@
# error DISTRHO_PLUGIN_WANT_STATE undefined!
#endif

#if defined(__WIN32__) || defined(__WIN64__)
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
# define DISTRHO_PLUGIN_EXPORT extern "C" __declspec (dllexport)
# define DISTRHO_OS_WINDOWS 1
# define DISTRHO_DLL_EXTENSION "dll"


Loading…
Cancel
Save