@@ -1,5 +1,5 @@ | |||
# ----------------------------------------- | |||
# Compile all the Plugins and Ports | |||
# Compile all the Ports | |||
PREFIX = /usr/local | |||
@@ -12,7 +12,6 @@ all: | |||
$(MAKE) -C libs/juce | |||
$(MAKE) -C libs/juced | |||
$(MAKE) -C libs/lv2-ttl-generator | |||
$(MAKE) -C plugins plugins | |||
$(MAKE) -C ports plugins | |||
$(MAKE) gen | |||
@@ -21,7 +20,6 @@ all: | |||
install: | |||
# make dirs | |||
install -d $(DESTDIR)$(PREFIX)/lib/dssi/ | |||
install -d $(DESTDIR)$(PREFIX)/lib/lv2/ | |||
install -d $(DESTDIR)$(PREFIX)/lib/vst/ | |||
install -d $(DESTDIR)/usr/src/distrho/libs/juce/build-juce/ | |||
@@ -30,7 +28,6 @@ install: | |||
install -d $(DESTDIR)/usr/src/distrho/scripts/ | |||
# install plugins | |||
cp -r bin/dssi/* $(DESTDIR)$(PREFIX)/lib/dssi/ | |||
cp -r bin/lv2/*.lv2/ $(DESTDIR)$(PREFIX)/lib/lv2/ | |||
cp -r bin/vst/* $(DESTDIR)$(PREFIX)/lib/vst/ | |||
cp -r static-lv2-ttl/*.lv2/ $(DESTDIR)$(PREFIX)/lib/lv2/ | |||
@@ -72,7 +69,6 @@ clean: | |||
$(MAKE) clean -C libs/juce | |||
$(MAKE) clean -C libs/juced | |||
$(MAKE) clean -C libs/lv2-ttl-generator | |||
$(MAKE) clean -C plugins | |||
$(MAKE) clean -C ports | |||
rm -rf bin/lv2/*.lv2/ | |||
rm -rf bin/lv2-extra/ | |||
@@ -83,7 +79,6 @@ distclean: clean | |||
$(MAKE) distclean -C libs/drowaudio | |||
$(MAKE) distclean -C libs/juce | |||
$(MAKE) distclean -C libs/juced | |||
$(MAKE) distclean -C plugins | |||
$(MAKE) distclean -C ports | |||
# ----------------------------------------- | |||
@@ -95,17 +90,12 @@ mingw: | |||
# ----------------------------------------- | |||
# Custom build types | |||
dssi: | |||
$(MAKE) -C libs/dgl | |||
$(MAKE) -C plugins dssi | |||
lv2: | |||
$(MAKE) -C libs/dgl | |||
$(MAKE) -C libs/drowaudio | |||
$(MAKE) -C libs/juce | |||
$(MAKE) -C libs/juced | |||
$(MAKE) -C libs/lv2-ttl-generator | |||
$(MAKE) -C plugins lv2 | |||
$(MAKE) -C ports lv2 | |||
$(MAKE) gen_lv2 | |||
@@ -114,6 +104,5 @@ vst: | |||
$(MAKE) -C libs/drowaudio | |||
$(MAKE) -C libs/juce | |||
$(MAKE) -C libs/juced | |||
$(MAKE) -C plugins vst | |||
$(MAKE) -C ports vst | |||
$(MAKE) gen_vst |
@@ -3,16 +3,8 @@ | |||
----------------------- | |||
DISTRHO is an open source project that has the goal of making cross-platform plugins and Linux ports. | |||
The DISTRHO Team currently has 2 members - falkTX (the coder) and nieee (graphics designer). | |||
The source repository is layered out this way: | |||
bin/ - directory where all the compiled binaries will be placed | |||
libs/ - libraries | |||
plugins/ - plugins developed and/or designed by the DISTRHO Team | |||
ports/ - plugin ports (plugins not made by us) | |||
scripts/ - build scripts | |||
sdks/ - SDKs must be placed here (VST SDK) | |||
<b>This repository contains the Linux ports</b>. | |||
----------------------------------------------------------------------------------------- | |||
---- BUILD DEPENDENCIES | |||
@@ -22,14 +14,13 @@ To build plugins, you first need to install the following dependencies: | |||
All OSes: | |||
- csound (version 6) | |||
- liblo | |||
- premake (version 3) | |||
Linux: (development versions of these) | |||
- ladspa | |||
- freetype2 | |||
- OpenGL | |||
- OpenGL/Mesa | |||
- X11 core and extensions (Xinerama, XShm, XRender and XCursor) | |||
@@ -47,7 +38,7 @@ You are now ready to start building. Run this on the source root folder: | |||
$ make | |||
If you just want to build specific plugin versions, you can use 'make dssi', 'make lv2' or 'make vst'. | |||
If you just want to build specific plugin versions, you can use 'make lv2' or 'make vst'. | |||
To build in debug mode, use this: | |||
@@ -1,66 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_APP_HPP_INCLUDED | |||
#define DGL_APP_HPP_INCLUDED | |||
#include "Base.hpp" | |||
START_NAMESPACE_DGL | |||
class Window; | |||
// ----------------------------------------------------------------------- | |||
class App | |||
{ | |||
public: | |||
class IdleCallback | |||
{ | |||
public: | |||
virtual ~IdleCallback() {} | |||
virtual void idleCallback() = 0; | |||
}; | |||
App(); | |||
~App(); | |||
void idle(); | |||
void exec(); | |||
void quit(); | |||
bool isQuiting() const; | |||
void addIdleCallback(IdleCallback* const callback); | |||
void removeIdleCallback(IdleCallback* const callback); | |||
private: | |||
struct PrivateData; | |||
PrivateData* const pData; | |||
friend class Window; | |||
void _addWindow(Window* const window); | |||
void _removeWindow(Window* const window); | |||
void _oneShown(); | |||
void _oneHidden(); | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(App) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_APP_HPP_INCLUDED |
@@ -1,111 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_BASE_HPP_INCLUDED | |||
#define DGL_BASE_HPP_INCLUDED | |||
#include "../distrho/extra/d_leakdetector.hpp" | |||
// ----------------------------------------------------------------------- | |||
/* Define namespace */ | |||
#ifndef DGL_NAMESPACE | |||
# define DGL_NAMESPACE DGL | |||
#endif | |||
#define START_NAMESPACE_DGL namespace DGL_NAMESPACE { | |||
#define END_NAMESPACE_DGL } | |||
#define USE_NAMESPACE_DGL using namespace DGL_NAMESPACE; | |||
/* GL includes */ | |||
#ifdef DISTRHO_OS_MAC | |||
# include <OpenGL/gl.h> | |||
#else | |||
# include <GL/gl.h> | |||
#endif | |||
/* missing GL defines */ | |||
#if defined(GL_BGR_EXT) && ! defined(GL_BGR) | |||
# define GL_BGR GL_BGR_EXT | |||
#endif | |||
#if defined(GL_BGRA_EXT) && ! defined(GL_BGRA) | |||
# define GL_BGRA GL_BGRA_EXT | |||
#endif | |||
#ifndef GL_CLAMP_TO_BORDER | |||
# define GL_CLAMP_TO_BORDER 0x812D | |||
#endif | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
/* | |||
* Convenience symbols for ASCII control characters. | |||
*/ | |||
enum Char { | |||
CHAR_BACKSPACE = 0x08, | |||
CHAR_ESCAPE = 0x1B, | |||
CHAR_DELETE = 0x7F | |||
}; | |||
/* | |||
* Special (non-Unicode) keyboard keys. | |||
*/ | |||
enum Key { | |||
KEY_F1 = 1, | |||
KEY_F2, | |||
KEY_F3, | |||
KEY_F4, | |||
KEY_F5, | |||
KEY_F6, | |||
KEY_F7, | |||
KEY_F8, | |||
KEY_F9, | |||
KEY_F10, | |||
KEY_F11, | |||
KEY_F12, | |||
KEY_LEFT, | |||
KEY_UP, | |||
KEY_RIGHT, | |||
KEY_DOWN, | |||
KEY_PAGE_UP, | |||
KEY_PAGE_DOWN, | |||
KEY_HOME, | |||
KEY_END, | |||
KEY_INSERT, | |||
KEY_SHIFT, | |||
KEY_CTRL, | |||
KEY_ALT, | |||
KEY_SUPER | |||
}; | |||
/* | |||
* Keyboard modifier flags. | |||
*/ | |||
enum Modifier { | |||
MODIFIER_SHIFT = 1 << 0, /**< Shift key */ | |||
MODIFIER_CTRL = 1 << 1, /**< Control key */ | |||
MODIFIER_ALT = 1 << 2, /**< Alt/Option key */ | |||
MODIFIER_SUPER = 1 << 3 /**< Mod4/Command/Windows key */ | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_BASE_HPP_INCLUDED |
@@ -1,208 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_CAIRO_WIDGET_HPP_INCLUDED | |||
#define DGL_CAIRO_WIDGET_HPP_INCLUDED | |||
#include "Widget.hpp" | |||
#include <cairo.h> | |||
#include <cstdio> | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
class CairoWidget : public Widget | |||
{ | |||
public: | |||
CairoWidget(Window& parent) | |||
: Widget(parent), | |||
fContext(nullptr), | |||
fSurface(nullptr), | |||
fTextureId(0) | |||
{ | |||
} | |||
virtual void setWidth(int width) override | |||
{ | |||
if (fArea.getWidth() == width) | |||
return; | |||
Widget::setWidth(width); | |||
_recreateSurface(); | |||
} | |||
virtual void setHeight(int height) override | |||
{ | |||
if (fArea.getHeight() == height) | |||
return; | |||
Widget::setHeight(height); | |||
_recreateSurface(); | |||
} | |||
virtual void setSize(const Size<int>& size) override | |||
{ | |||
if (fArea.getSize() == size) | |||
return; | |||
Widget::setSize(size); | |||
_recreateSurface(); | |||
} | |||
void setSize(int width, int height) | |||
{ | |||
setSize(Size<int>(width, height)); | |||
} | |||
protected: | |||
virtual void cairoDisplay(cairo_t* const context) = 0; | |||
private: | |||
void onDisplay() override | |||
{ | |||
// wait for sizing | |||
if (fSurface == nullptr || fContext == nullptr) | |||
{ | |||
printf("invalid surface\n"); | |||
return; | |||
} | |||
if (fTextureId == 0) | |||
glGenTextures(1, &fTextureId); | |||
if (fTextureId == 0) | |||
{ | |||
// TODO: invalidate widget | |||
printf("invalid texture\n"); | |||
return; | |||
} | |||
#if 1 | |||
const int x = getX(); | |||
const int y = getY(); | |||
const int width = getWidth(); | |||
const int height = getHeight(); | |||
// draw cairo stuff | |||
cairoDisplay(fContext); | |||
// get cairo surface data (RGB24) | |||
unsigned char* const surfaceData = cairo_image_surface_get_data(fSurface); | |||
// enable GL texture | |||
glEnable(GL_TEXTURE_RECTANGLE_ARB); | |||
// set texture params | |||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); | |||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); | |||
glTexParameteri(GL_TEXTURE_RECTANGLE_ARB, GL_TEXTURE_MAG_FILTER, GL_LINEAR); | |||
// bind texture to surface data | |||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, fTextureId); | |||
glTexImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, GL_RGBA, width, height, 0, GL_BGRA, GL_UNSIGNED_BYTE, surfaceData); | |||
// draw the texture | |||
// glBegin(GL_QUADS); | |||
// glTexCoord2f(0.0f, 0.0f); | |||
// glVertex2i(x, y); | |||
// | |||
// glTexCoord2f(1.0f, 0.0f); | |||
// glVertex2i(x+width, y); | |||
// | |||
// glTexCoord2f(1.0f, 1.0f); | |||
// glVertex2i(x+width, y+height); | |||
// | |||
// glTexCoord2f(0.0f, 1.0f); | |||
// glVertex2i(x, y+height); | |||
// glEnd(); | |||
glBegin(GL_QUADS); | |||
//glTexCoord2i(x, y); | |||
glTexCoord2i(0, 0); | |||
glVertex2i(x, y); | |||
//glTexCoord2i(x+width, y); | |||
glTexCoord2i(width, 0); | |||
glVertex2i(x+width, y); | |||
//glTexCoord2i(x+width, y+height); | |||
glTexCoord2i(width, height); | |||
glVertex2i(x+width, y+height); | |||
//glTexCoord2i(x, y+height); | |||
glTexCoord2i(0, height); | |||
glVertex2i(x, y+height); | |||
glEnd(); | |||
// cleanup | |||
glBindTexture(GL_TEXTURE_RECTANGLE_ARB, 0); | |||
glDisable(GL_TEXTURE_RECTANGLE_ARB); | |||
#endif | |||
} | |||
void onClose() override | |||
{ | |||
if (fContext != nullptr) | |||
{ | |||
cairo_destroy(fContext); | |||
fContext = nullptr; | |||
} | |||
if (fSurface != nullptr) | |||
{ | |||
cairo_surface_destroy(fSurface); | |||
fSurface = nullptr; | |||
} | |||
if (fTextureId != 0) | |||
{ | |||
glDeleteTextures(1, &fTextureId); | |||
fTextureId = 0; | |||
} | |||
} | |||
void _recreateSurface() | |||
{ | |||
if (fContext != nullptr) | |||
cairo_destroy(fContext); | |||
if (fSurface != nullptr) | |||
cairo_surface_destroy(fSurface); | |||
fSurface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, fArea.getWidth(), fArea.getHeight()); | |||
if (fSurface != nullptr) | |||
fContext = cairo_create(fSurface); | |||
else | |||
fContext = nullptr; | |||
} | |||
private: | |||
cairo_t* fContext; | |||
cairo_surface_t* fSurface; | |||
GLuint fTextureId; | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(CairoWidget) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_CAIRO_WIDGET_HPP_INCLUDED |
@@ -1,139 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_GEOMETRY_HPP_INCLUDED | |||
#define DGL_GEOMETRY_HPP_INCLUDED | |||
#include "Base.hpp" | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
template<typename T> | |||
class Point | |||
{ | |||
public: | |||
Point() noexcept; | |||
Point(T x, T y) noexcept; | |||
Point(const Point<T>& pos) noexcept; | |||
T getX() const noexcept; | |||
T getY() const noexcept; | |||
void setX(T x) noexcept; | |||
void setY(T y) noexcept; | |||
void move(T x, T y) noexcept; | |||
void move(const Point<T>& pos) noexcept; | |||
Point<T>& operator=(const Point<T>& pos) noexcept; | |||
Point<T>& operator+=(const Point<T>& pos) noexcept; | |||
Point<T>& operator-=(const Point<T>& pos) noexcept; | |||
bool operator==(const Point<T>& pos) const noexcept; | |||
bool operator!=(const Point<T>& pos) const noexcept; | |||
private: | |||
T fX, fY; | |||
template<typename> friend class Rectangle; | |||
DISTRHO_PREVENT_HEAP_ALLOCATION | |||
}; | |||
// ----------------------------------------------------------------------- | |||
template<typename T> | |||
class Size | |||
{ | |||
public: | |||
Size() noexcept; | |||
Size(T width, T height) noexcept; | |||
Size(const Size<T>& size) noexcept; | |||
T getWidth() const noexcept; | |||
T getHeight() const noexcept; | |||
void setWidth(T width) noexcept; | |||
void setHeight(T height) noexcept; | |||
Size<T>& operator=(const Size<T>& size) noexcept; | |||
Size<T>& operator+=(const Size<T>& size) noexcept; | |||
Size<T>& operator-=(const Size<T>& size) noexcept; | |||
Size<T>& operator*=(T m) noexcept; | |||
Size<T>& operator/=(T d) noexcept; | |||
bool operator==(const Size<T>& size) const noexcept; | |||
bool operator!=(const Size<T>& size) const noexcept; | |||
private: | |||
T fWidth, fHeight; | |||
template<typename> friend class Rectangle; | |||
DISTRHO_PREVENT_HEAP_ALLOCATION | |||
}; | |||
// ----------------------------------------------------------------------- | |||
template<typename T> | |||
class Rectangle | |||
{ | |||
public: | |||
Rectangle() noexcept; | |||
Rectangle(T x, T y, T width, T height) noexcept; | |||
Rectangle(T x, T y, const Size<T>& size) noexcept; | |||
Rectangle(const Point<T>& pos, T width, T height) noexcept; | |||
Rectangle(const Point<T>& pos, const Size<T>& size) noexcept; | |||
Rectangle(const Rectangle<T>& rect) noexcept; | |||
T getX() const noexcept; | |||
T getY() const noexcept; | |||
T getWidth() const noexcept; | |||
T getHeight() const noexcept; | |||
const Point<T>& getPos() const noexcept; | |||
const Size<T>& getSize() const noexcept; | |||
bool contains(T x, T y) const noexcept; | |||
bool contains(const Point<T>& pos) const noexcept; | |||
bool containsX(T x) const noexcept; | |||
bool containsY(T y) const noexcept; | |||
void setX(T x) noexcept; | |||
void setY(T y) noexcept; | |||
void setPos(T x, T y) noexcept; | |||
void setPos(const Point<T>& pos) noexcept; | |||
void move(T x, T y) noexcept; | |||
void move(const Point<T>& pos) noexcept; | |||
void setWidth(T width) noexcept; | |||
void setHeight(T height) noexcept; | |||
void setSize(T width, T height) noexcept; | |||
void setSize(const Size<T>& size) noexcept; | |||
Rectangle<T>& operator=(const Rectangle<T>& rect) noexcept; | |||
private: | |||
Point<T> fPos; | |||
Size<T> fSize; | |||
DISTRHO_PREVENT_HEAP_ALLOCATION | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_GEOMETRY_HPP_INCLUDED |
@@ -1,70 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_IMAGE_HPP_INCLUDED | |||
#define DGL_IMAGE_HPP_INCLUDED | |||
#include "Geometry.hpp" | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
class Image | |||
{ | |||
public: | |||
Image() noexcept; | |||
Image(const char* rawData, int width, int height, GLenum format = GL_BGRA, GLenum type = GL_UNSIGNED_BYTE) noexcept; | |||
Image(const char* rawData, const Size<int>& size, GLenum format = GL_BGRA, GLenum type = GL_UNSIGNED_BYTE) noexcept; | |||
Image(const Image& image) noexcept; | |||
~Image(); | |||
void loadFromMemory(const char* rawData, int width, int height, GLenum format = GL_BGRA, GLenum type = GL_UNSIGNED_BYTE) noexcept; | |||
void loadFromMemory(const char* rawData, const Size<int>& size, GLenum format = GL_BGRA, GLenum type = GL_UNSIGNED_BYTE) noexcept; | |||
bool isValid() const noexcept; | |||
int getWidth() const noexcept; | |||
int getHeight() const noexcept; | |||
const Size<int>& getSize() const noexcept; | |||
const char* getRawData() const noexcept; | |||
GLenum getFormat() const noexcept; | |||
GLenum getType() const noexcept; | |||
void draw(); | |||
void draw(int x, int y); | |||
void draw(const Point<int>& pos); | |||
Image& operator=(const Image& image) noexcept; | |||
bool operator==(const Image& image) const noexcept; | |||
bool operator!=(const Image& image) const noexcept; | |||
private: | |||
const char* fRawData; | |||
Size<int> fSize; | |||
GLenum fFormat; | |||
GLenum fType; | |||
GLuint fTextureId; | |||
DISTRHO_PREVENT_HEAP_ALLOCATION | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_IMAGE_HPP_INCLUDED |
@@ -1,58 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_IMAGE_ABOUT_WINDOW_HPP_INCLUDED | |||
#define DGL_IMAGE_ABOUT_WINDOW_HPP_INCLUDED | |||
#include "Image.hpp" | |||
#include "Widget.hpp" | |||
#include "Window.hpp" | |||
#ifdef PROPER_CPP11_SUPPORT | |||
# include <cstdint> | |||
#else | |||
# include <stdint.h> | |||
#endif | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
class ImageAboutWindow : public Window, | |||
public Widget | |||
{ | |||
public: | |||
ImageAboutWindow(App& app, Window& parent, const Image& image = Image()); | |||
ImageAboutWindow(Widget* widget, const Image& image = Image()); | |||
void setImage(const Image& image); | |||
protected: | |||
void onDisplay() override; | |||
bool onMouse(int button, bool press, int x, int y) override; | |||
bool onKeyboard(bool press, uint32_t key) override; | |||
private: | |||
Image fImgBackground; | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(ImageAboutWindow) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_IMAGE_ABOUT_WINDOW_HPP_INCLUDED |
@@ -1,66 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_IMAGE_BUTTON_HPP_INCLUDED | |||
#define DGL_IMAGE_BUTTON_HPP_INCLUDED | |||
#include "Image.hpp" | |||
#include "Widget.hpp" | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
class ImageButton : public Widget | |||
{ | |||
public: | |||
class Callback | |||
{ | |||
public: | |||
virtual ~Callback() {} | |||
virtual void imageButtonClicked(ImageButton* imageButton, int button) = 0; | |||
}; | |||
ImageButton(Window& parent, const Image& image); | |||
ImageButton(Widget* widget, const Image& image); | |||
ImageButton(Window& parent, const Image& imageNormal, const Image& imageHover, const Image& imageDown); | |||
ImageButton(Widget* widget, const Image& imageNormal, const Image& imageHover, const Image& imageDown); | |||
ImageButton(const ImageButton& imageButton); | |||
void setCallback(Callback* callback); | |||
protected: | |||
void onDisplay() override; | |||
bool onMouse(int button, bool press, int x, int y) override; | |||
bool onMotion(int x, int y) override; | |||
private: | |||
Image fImageNormal; | |||
Image fImageHover; | |||
Image fImageDown; | |||
Image* fCurImage; | |||
int fCurButton; | |||
Callback* fCallback; | |||
DISTRHO_LEAK_DETECTOR(ImageButton) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_IMAGE_BUTTON_HPP_INCLUDED |
@@ -1,94 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_IMAGE_KNOB_HPP_INCLUDED | |||
#define DGL_IMAGE_KNOB_HPP_INCLUDED | |||
#include "Image.hpp" | |||
#include "Widget.hpp" | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
class ImageKnob : public Widget | |||
{ | |||
public: | |||
enum Orientation { | |||
Horizontal, | |||
Vertical | |||
}; | |||
class Callback | |||
{ | |||
public: | |||
virtual ~Callback() {} | |||
virtual void imageKnobDragStarted(ImageKnob* imageKnob) = 0; | |||
virtual void imageKnobDragFinished(ImageKnob* imageKnob) = 0; | |||
virtual void imageKnobValueChanged(ImageKnob* imageKnob, float value) = 0; | |||
}; | |||
ImageKnob(Window& parent, const Image& image, Orientation orientation = Vertical); | |||
ImageKnob(Widget* widget, const Image& image, Orientation orientation = Vertical); | |||
ImageKnob(const ImageKnob& imageKnob); | |||
float getValue() const; | |||
void setOrientation(Orientation orientation); | |||
void setRange(float min, float max); | |||
void setStep(float step); | |||
void setValue(float value, bool sendCallback = false); | |||
void setRotationAngle(int angle); | |||
void setCallback(Callback* callback); | |||
protected: | |||
void onDisplay() override; | |||
bool onMouse(int button, bool press, int x, int y) override; | |||
bool onMotion(int x, int y) override; | |||
void onReshape(int width, int height) override; | |||
void onClose() override; | |||
private: | |||
Image fImage; | |||
float fMinimum; | |||
float fMaximum; | |||
float fStep; | |||
float fValue; | |||
float fValueTmp; | |||
Orientation fOrientation; | |||
int fRotationAngle; | |||
bool fDragging; | |||
int fLastX; | |||
int fLastY; | |||
Callback* fCallback; | |||
bool fIsImgVertical; | |||
int fImgLayerSize; | |||
int fImgLayerCount; | |||
Rectangle<int> fKnobArea; | |||
GLuint fTextureId; | |||
DISTRHO_LEAK_DETECTOR(ImageKnob) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_IMAGE_KNOB_HPP_INCLUDED |
@@ -1,90 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_IMAGE_SLIDER_HPP_INCLUDED | |||
#define DGL_IMAGE_SLIDER_HPP_INCLUDED | |||
#include "Image.hpp" | |||
#include "Widget.hpp" | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
class ImageSlider : public Widget | |||
{ | |||
public: | |||
class Callback | |||
{ | |||
public: | |||
virtual ~Callback() {} | |||
virtual void imageSliderDragStarted(ImageSlider* imageSlider) = 0; | |||
virtual void imageSliderDragFinished(ImageSlider* imageSlider) = 0; | |||
virtual void imageSliderValueChanged(ImageSlider* imageSlider, float value) = 0; | |||
}; | |||
ImageSlider(Window& parent, const Image& image); | |||
ImageSlider(Widget* widget, const Image& image); | |||
ImageSlider(const ImageSlider& imageSlider); | |||
float getValue() const; | |||
void setStartPos(const Point<int>& startPos); | |||
void setStartPos(int x, int y); | |||
void setEndPos(const Point<int>& endPos); | |||
void setEndPos(int x, int y); | |||
void setInverted(bool inverted); | |||
void setRange(float min, float max); | |||
void setStep(float step); | |||
void setValue(float value, bool sendCallback = false); | |||
void setCallback(Callback* callback); | |||
protected: | |||
void onDisplay() override; | |||
bool onMouse(int button, bool press, int x, int y) override; | |||
bool onMotion(int x, int y) override; | |||
private: | |||
Image fImage; | |||
float fMinimum; | |||
float fMaximum; | |||
float fStep; | |||
float fValue; | |||
float fValueTmp; | |||
bool fDragging; | |||
bool fInverted; | |||
int fStartedX; | |||
int fStartedY; | |||
Callback* fCallback; | |||
Point<int> fStartPos; | |||
Point<int> fEndPos; | |||
Rectangle<int> fSliderArea; | |||
void _recheckArea(); | |||
DISTRHO_LEAK_DETECTOR(ImageSlider) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_IMAGE_SLIDER_HPP_INCLUDED |
@@ -1,21 +0,0 @@ | |||
# Compile the dgl library | |||
all: build | |||
build: dgl | |||
dgl: | |||
$(MAKE) -C build | |||
clean: | |||
$(MAKE) clean -C build | |||
rm -rf build-*/intermediate | |||
distclean: clean | |||
rm -f build-*/Makefile | |||
rm -f build-*/*.make | |||
rm -f build-*/*.sln | |||
rm -f build-*/*.vcproj |
@@ -1,81 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_STANDALONE_WINDOW_HPP_INCLUDED | |||
#define DGL_STANDALONE_WINDOW_HPP_INCLUDED | |||
#include "App.hpp" | |||
#include "Window.hpp" | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
class StandaloneWindow | |||
{ | |||
public: | |||
StandaloneWindow() | |||
: fApp(), | |||
fWindow(fApp) | |||
{ | |||
} | |||
App& getApp() noexcept | |||
{ | |||
return fApp; | |||
} | |||
Window& getWindow() noexcept | |||
{ | |||
return fWindow; | |||
} | |||
void exec() | |||
{ | |||
fWindow.show(); | |||
fApp.exec(); | |||
} | |||
// ------------------------------------------------------------------- | |||
// helpers | |||
void setResizable(bool yesNo) | |||
{ | |||
fWindow.setResizable(yesNo); | |||
} | |||
void setSize(unsigned int width, unsigned int height) | |||
{ | |||
fWindow.setSize(width, height); | |||
} | |||
void setTitle(const char* title) | |||
{ | |||
fWindow.setTitle(title); | |||
} | |||
protected: | |||
App fApp; | |||
Window fWindow; | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(StandaloneWindow) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_STANDALONE_WINDOW_HPP_INCLUDED |
@@ -1,108 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_WIDGET_HPP_INCLUDED | |||
#define DGL_WIDGET_HPP_INCLUDED | |||
#include "Geometry.hpp" | |||
#ifdef PROPER_CPP11_SUPPORT | |||
# include <cstdint> | |||
#else | |||
# include <stdint.h> | |||
#endif | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
class App; | |||
class Window; | |||
class Widget | |||
{ | |||
public: | |||
Widget(Window& parent); | |||
virtual ~Widget(); | |||
bool isVisible() const noexcept; | |||
void setVisible(bool yesNo); | |||
void show(); | |||
void hide(); | |||
int getX() const noexcept; | |||
int getY() const noexcept; | |||
const Point<int>& getPos() const noexcept; | |||
void setX(int x); | |||
void setY(int y); | |||
void setPos(int x, int y); | |||
void setPos(const Point<int>& pos); | |||
void move(int x, int y); | |||
void move(const Point<int>& pos); | |||
int getWidth() const noexcept; | |||
int getHeight() const noexcept; | |||
const Size<int>& getSize() const noexcept; | |||
// virtual needed by cairo | |||
virtual void setWidth(int width); | |||
virtual void setHeight(int height); | |||
virtual void setSize(const Size<int>& size); | |||
void setSize(int width, int height) | |||
{ | |||
setSize(Size<int>(width, height)); | |||
} | |||
const Rectangle<int>& getArea() const noexcept; | |||
uint32_t getEventTimestamp(); | |||
int getModifiers(); | |||
App& getParentApp() const noexcept; | |||
Window& getParentWindow() const noexcept; | |||
void repaint(); | |||
protected: | |||
virtual void onDisplay() = 0; | |||
virtual bool onKeyboard(bool press, uint32_t key); | |||
virtual bool onMouse(int button, bool press, int x, int y); | |||
virtual bool onMotion(int x, int y); | |||
virtual bool onScroll(int x, int y, float dx, float dy); | |||
virtual bool onSpecial(bool press, Key key); | |||
virtual void onReshape(int width, int height); | |||
virtual void onClose(); | |||
private: | |||
Window& fParent; | |||
bool fVisible; | |||
Rectangle<int> fArea; | |||
friend class CairoWidget; | |||
friend class Window; | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Widget) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_WIDGET_HPP_INCLUDED |
@@ -1,88 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#ifndef DGL_WINDOW_HPP_INCLUDED | |||
#define DGL_WINDOW_HPP_INCLUDED | |||
#include "Geometry.hpp" | |||
#ifdef PROPER_CPP11_SUPPORT | |||
# include <cstdint> | |||
#else | |||
# include <stdint.h> | |||
#endif | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
class App; | |||
class Widget; | |||
class Window | |||
{ | |||
public: | |||
Window(App& app); | |||
Window(App& app, Window& parent); | |||
Window(App& app, intptr_t parentId); | |||
virtual ~Window(); | |||
void show(); | |||
void hide(); | |||
void close(); | |||
void exec(bool lockWait = false); | |||
void focus(); | |||
void repaint(); | |||
bool isVisible() const noexcept; | |||
void setVisible(bool yesNo); | |||
bool isResizable() const noexcept; | |||
void setResizable(bool yesNo); | |||
int getWidth() const noexcept; | |||
int getHeight() const noexcept; | |||
Size<int> getSize() const noexcept; | |||
void setSize(unsigned int width, unsigned int height); | |||
void setTitle(const char* title); | |||
void setTransientWinId(intptr_t winId); | |||
App& getApp() const noexcept; | |||
uint32_t getEventTimestamp() const; | |||
int getModifiers() const; | |||
intptr_t getWindowId() const; | |||
private: | |||
class PrivateData; | |||
PrivateData* const pData; | |||
friend class App; | |||
friend class Widget; | |||
void _addWidget(Widget* const widget); | |||
void _removeWidget(Widget* const widget); | |||
void _idle(); | |||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(Window) | |||
}; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
#endif // DGL_WINDOW_HPP_INCLUDED |
@@ -1,22 +0,0 @@ | |||
dofile("../../../scripts/make-project.lua") | |||
package = make_library_project("dgl") | |||
package.includepaths = { | |||
".." | |||
} | |||
package.files = { | |||
matchfiles ( | |||
"../src/*.cpp" | |||
) | |||
} | |||
if (macosx) then | |||
package.files = { | |||
package.files, | |||
"../src/pugl/pugl_osx.m.c", | |||
"../src/pugl/pugl_osx_extended.m.c" | |||
} | |||
end |
@@ -1,133 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#include "../App.hpp" | |||
#include "../Window.hpp" | |||
#include <list> | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
struct App::PrivateData { | |||
bool doLoop; | |||
unsigned visibleWindows; | |||
std::list<Window*> windows; | |||
std::list<IdleCallback*> idleCallbacks; | |||
PrivateData() | |||
: doLoop(false), | |||
visibleWindows(0) {} | |||
}; | |||
// ----------------------------------------------------------------------- | |||
App::App() | |||
: pData(new PrivateData()) | |||
{ | |||
} | |||
App::~App() | |||
{ | |||
pData->windows.clear(); | |||
pData->idleCallbacks.clear(); | |||
delete pData; | |||
} | |||
void App::idle() | |||
{ | |||
for (std::list<Window*>::iterator it = pData->windows.begin(); it != pData->windows.end(); ++it) | |||
{ | |||
Window* const window(*it); | |||
window->_idle(); | |||
} | |||
for (std::list<IdleCallback*>::iterator it = pData->idleCallbacks.begin(); it != pData->idleCallbacks.end(); ++it) | |||
{ | |||
IdleCallback* const idleCallback(*it); | |||
idleCallback->idleCallback(); | |||
} | |||
} | |||
void App::exec() | |||
{ | |||
while (pData->doLoop) | |||
{ | |||
idle(); | |||
d_msleep(10); | |||
} | |||
} | |||
void App::quit() | |||
{ | |||
pData->doLoop = false; | |||
for (std::list<Window*>::reverse_iterator rit = pData->windows.rbegin(); rit != pData->windows.rend(); ++rit) | |||
{ | |||
Window* const window(*rit); | |||
window->close(); | |||
} | |||
} | |||
bool App::isQuiting() const | |||
{ | |||
return !pData->doLoop; | |||
} | |||
// ----------------------------------------------------------------------- | |||
void App::addIdleCallback(IdleCallback* const callback) | |||
{ | |||
if (callback != nullptr) | |||
pData->idleCallbacks.push_back(callback); | |||
} | |||
void App::removeIdleCallback(IdleCallback* const callback) | |||
{ | |||
if (callback != nullptr) | |||
pData->idleCallbacks.remove(callback); | |||
} | |||
// ----------------------------------------------------------------------- | |||
void App::_addWindow(Window* const window) | |||
{ | |||
if (window != nullptr) | |||
pData->windows.push_back(window); | |||
} | |||
void App::_removeWindow(Window* const window) | |||
{ | |||
if (window != nullptr) | |||
pData->windows.remove(window); | |||
} | |||
void App::_oneShown() | |||
{ | |||
if (++pData->visibleWindows == 1) | |||
pData->doLoop = true; | |||
} | |||
void App::_oneHidden() | |||
{ | |||
if (--pData->visibleWindows == 0) | |||
pData->doLoop = false; | |||
} | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL |
@@ -1,416 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#include "../Geometry.hpp" | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
// Point | |||
template<typename T> | |||
Point<T>::Point() noexcept | |||
: fX(0), | |||
fY(0) | |||
{ | |||
} | |||
template<typename T> | |||
Point<T>::Point(T x, T y) noexcept | |||
: fX(x), | |||
fY(y) | |||
{ | |||
} | |||
template<typename T> | |||
Point<T>::Point(const Point& pos) noexcept | |||
: fX(pos.fX), | |||
fY(pos.fY) | |||
{ | |||
} | |||
template<typename T> | |||
T Point<T>::getX() const noexcept | |||
{ | |||
return fX; | |||
} | |||
template<typename T> | |||
T Point<T>::getY() const noexcept | |||
{ | |||
return fY; | |||
} | |||
template<typename T> | |||
void Point<T>::setX(T x) noexcept | |||
{ | |||
fX = x; | |||
} | |||
template<typename T> | |||
void Point<T>::setY(T y) noexcept | |||
{ | |||
fY = y; | |||
} | |||
template<typename T> | |||
void Point<T>::move(T x, T y) noexcept | |||
{ | |||
fX += x; | |||
fY += y; | |||
} | |||
template<typename T> | |||
void Point<T>::move(const Point& pos) noexcept | |||
{ | |||
fX += pos.fX; | |||
fY += pos.fY; | |||
} | |||
template<typename T> | |||
Point<T>& Point<T>::operator=(const Point<T>& pos) noexcept | |||
{ | |||
fX = pos.fX; | |||
fY = pos.fY; | |||
return *this; | |||
} | |||
template<typename T> | |||
Point<T>& Point<T>::operator+=(const Point<T>& pos) noexcept | |||
{ | |||
fX += pos.fX; | |||
fY += pos.fY; | |||
return *this; | |||
} | |||
template<typename T> | |||
Point<T>& Point<T>::operator-=(const Point<T>& pos) noexcept | |||
{ | |||
fX -= pos.fX; | |||
fY -= pos.fY; | |||
return *this; | |||
} | |||
template<typename T> | |||
bool Point<T>::operator==(const Point<T>& pos) const noexcept | |||
{ | |||
return (fX == pos.fX && fY== pos.fY); | |||
} | |||
template<typename T> | |||
bool Point<T>::operator!=(const Point<T>& pos) const noexcept | |||
{ | |||
return !operator==(pos); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Size | |||
template<typename T> | |||
Size<T>::Size() noexcept | |||
: fWidth(0), | |||
fHeight(0) | |||
{ | |||
} | |||
template<typename T> | |||
Size<T>::Size(T width, T height) noexcept | |||
: fWidth(width), | |||
fHeight(height) | |||
{ | |||
} | |||
template<typename T> | |||
Size<T>::Size(const Size<T>& size) noexcept | |||
: fWidth(size.fWidth), | |||
fHeight(size.fHeight) | |||
{ | |||
} | |||
template<typename T> | |||
T Size<T>::getWidth() const noexcept | |||
{ | |||
return fWidth; | |||
} | |||
template<typename T> | |||
T Size<T>::getHeight() const noexcept | |||
{ | |||
return fHeight; | |||
} | |||
template<typename T> | |||
void Size<T>::setWidth(T width) noexcept | |||
{ | |||
fWidth = width; | |||
} | |||
template<typename T> | |||
void Size<T>::setHeight(T height) noexcept | |||
{ | |||
fHeight = height; | |||
} | |||
template<typename T> | |||
Size<T>& Size<T>::operator=(const Size<T>& size) noexcept | |||
{ | |||
fWidth = size.fWidth; | |||
fHeight = size.fHeight; | |||
return *this; | |||
} | |||
template<typename T> | |||
Size<T>& Size<T>::operator+=(const Size<T>& size) noexcept | |||
{ | |||
fWidth += size.fWidth; | |||
fHeight += size.fHeight; | |||
return *this; | |||
} | |||
template<typename T> | |||
Size<T>& Size<T>::operator-=(const Size<T>& size) noexcept | |||
{ | |||
fWidth -= size.fWidth; | |||
fHeight -= size.fHeight; | |||
return *this; | |||
} | |||
template<typename T> | |||
Size<T>& Size<T>::operator*=(T m) noexcept | |||
{ | |||
fWidth *= m; | |||
fHeight *= m; | |||
return *this; | |||
} | |||
template<typename T> | |||
Size<T>& Size<T>::operator/=(T d) noexcept | |||
{ | |||
fWidth /= d; | |||
fHeight /= d; | |||
return *this; | |||
} | |||
template<typename T> | |||
bool Size<T>::operator==(const Size<T>& size) const noexcept | |||
{ | |||
return (fWidth == size.fWidth && fHeight == size.fHeight); | |||
} | |||
template<typename T> | |||
bool Size<T>::operator!=(const Size<T>& size) const noexcept | |||
{ | |||
return !operator==(size); | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Rectangle | |||
template<typename T> | |||
Rectangle<T>::Rectangle() noexcept | |||
: fPos(0, 0), | |||
fSize(0, 0) | |||
{ | |||
} | |||
template<typename T> | |||
Rectangle<T>::Rectangle(T x, T y, T width, T height) noexcept | |||
: fPos(x, y), | |||
fSize(width, height) | |||
{ | |||
} | |||
template<typename T> | |||
Rectangle<T>::Rectangle(T x, T y, const Size<T>& size) noexcept | |||
: fPos(x, y), | |||
fSize(size) | |||
{ | |||
} | |||
template<typename T> | |||
Rectangle<T>::Rectangle(const Point<T>& pos, T width, T height) noexcept | |||
: fPos(pos), | |||
fSize(width, height) | |||
{ | |||
} | |||
template<typename T> | |||
Rectangle<T>::Rectangle(const Point<T>& pos, const Size<T>& size) noexcept | |||
: fPos(pos), | |||
fSize(size) | |||
{ | |||
} | |||
template<typename T> | |||
Rectangle<T>::Rectangle(const Rectangle<T>& rect) noexcept | |||
: fPos(rect.fPos), | |||
fSize(rect.fSize) | |||
{ | |||
} | |||
template<typename T> | |||
T Rectangle<T>::getX() const noexcept | |||
{ | |||
return fPos.fX; | |||
} | |||
template<typename T> | |||
T Rectangle<T>::getY() const noexcept | |||
{ | |||
return fPos.fY; | |||
} | |||
template<typename T> | |||
T Rectangle<T>::getWidth() const noexcept | |||
{ | |||
return fSize.fWidth; | |||
} | |||
template<typename T> | |||
T Rectangle<T>::getHeight() const noexcept | |||
{ | |||
return fSize.fHeight; | |||
} | |||
template<typename T> | |||
const Point<T>& Rectangle<T>::getPos() const noexcept | |||
{ | |||
return fPos; | |||
} | |||
template<typename T> | |||
const Size<T>& Rectangle<T>::getSize() const noexcept | |||
{ | |||
return fSize; | |||
} | |||
template<typename T> | |||
bool Rectangle<T>::contains(T x, T y) const noexcept | |||
{ | |||
return (x >= fPos.fX && y >= fPos.fY && x <= fPos.fX+fSize.fWidth && y <= fPos.fY+fSize.fHeight); | |||
} | |||
template<typename T> | |||
bool Rectangle<T>::contains(const Point<T>& pos) const noexcept | |||
{ | |||
return contains(pos.fX, pos.fY); | |||
} | |||
template<typename T> | |||
bool Rectangle<T>::containsX(T x) const noexcept | |||
{ | |||
return (x >= fPos.fX && x <= fPos.fX + fSize.fWidth); | |||
} | |||
template<typename T> | |||
bool Rectangle<T>::containsY(T y) const noexcept | |||
{ | |||
return (y >= fPos.fY && y <= fPos.fY + fSize.fHeight); | |||
} | |||
template<typename T> | |||
void Rectangle<T>::setX(T x) noexcept | |||
{ | |||
fPos.fX = x; | |||
} | |||
template<typename T> | |||
void Rectangle<T>::setY(T y) noexcept | |||
{ | |||
fPos.fY = y; | |||
} | |||
template<typename T> | |||
void Rectangle<T>::setPos(T x, T y) noexcept | |||
{ | |||
fPos.fX = x; | |||
fPos.fY = y; | |||
} | |||
template<typename T> | |||
void Rectangle<T>::setPos(const Point<T>& pos) noexcept | |||
{ | |||
fPos = pos; | |||
} | |||
template<typename T> | |||
void Rectangle<T>::move(T x, T y) noexcept | |||
{ | |||
fPos.fX += x; | |||
fPos.fY += y; | |||
} | |||
template<typename T> | |||
void Rectangle<T>::move(const Point<T>& pos) noexcept | |||
{ | |||
fPos += pos; | |||
} | |||
template<typename T> | |||
void Rectangle<T>::setWidth(T width) noexcept | |||
{ | |||
fSize.fWidth = width; | |||
} | |||
template<typename T> | |||
void Rectangle<T>::setHeight(T height) noexcept | |||
{ | |||
fSize.fHeight = height; | |||
} | |||
template<typename T> | |||
void Rectangle<T>::setSize(T width, T height) noexcept | |||
{ | |||
fSize.fWidth = width; | |||
fSize.fHeight = height; | |||
} | |||
template<typename T> | |||
void Rectangle<T>::setSize(const Size<T>& size) noexcept | |||
{ | |||
fSize = size; | |||
} | |||
template<typename T> | |||
Rectangle<T>& Rectangle<T>::operator=(const Rectangle<T>& rect) noexcept | |||
{ | |||
fPos = rect.fPos; | |||
fSize = rect.fSize; | |||
return *this; | |||
} | |||
// ----------------------------------------------------------------------- | |||
// Possible template data types | |||
template class Point<int>; | |||
template class Point<long>; | |||
template class Point<float>; | |||
template class Point<double>; | |||
template class Size<int>; | |||
template class Size<long>; | |||
template class Size<float>; | |||
template class Size<double>; | |||
template class Rectangle<int>; | |||
template class Rectangle<long>; | |||
template class Rectangle<float>; | |||
template class Rectangle<double>; | |||
// ----------------------------------------------------------------------- | |||
END_NAMESPACE_DGL | |||
@@ -1,198 +0,0 @@ | |||
/* | |||
* DISTRHO Plugin Framework (DPF) | |||
* Copyright (C) 2012-2014 Filipe Coelho <falktx@falktx.com> | |||
* | |||
* 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. | |||
* | |||
* THE 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. | |||
*/ | |||
#include "../Image.hpp" | |||
START_NAMESPACE_DGL | |||
// ----------------------------------------------------------------------- | |||
Image::Image() noexcept | |||
: fRawData(nullptr), | |||
fSize(0, 0), | |||
fFormat(0), | |||
fType(0), | |||
fTextureId(0) | |||
{ | |||
} | |||
Image::Image(const char* rawData, int width, int height, GLenum format, GLenum type) noexcept | |||
: fRawData(rawData), | |||
fSize(width, height), | |||
fFormat(format), | |||
fType(type), | |||
fTextureId(0) | |||
{ | |||
} | |||
Image::Image(const char* rawData, const Size<int>& size, GLenum format, GLenum type) noexcept | |||
: fRawData(rawData), | |||
fSize(size), | |||
fFormat(format), | |||
fType(type), | |||
fTextureId(0) | |||
{ | |||
} | |||
Image::Image(const Image& image) noexcept | |||
: fRawData(image.fRawData), | |||
fSize(image.fSize), | |||
fFormat(image.fFormat), | |||
fType(image.fType), | |||
fTextureId(0) | |||
{ | |||
} | |||
Image::~Image() | |||
{ | |||
if (fTextureId != 0) | |||
{ | |||
glDeleteTextures(1, &fTextureId); | |||
fTextureId = 0; | |||
} | |||
} | |||
void Image::loadFromMemory(const char* rawData, int width, int height, GLenum format, GLenum type) noexcept | |||
{ | |||
loadFromMemory(rawData, Size<int>(width, height), format, type); | |||
} | |||
void Image::loadFromMemory(const char* rawData, const Size<int>& size, GLenum format, GLenum type) noexcept | |||
{ | |||
fRawData = rawData; | |||
fSize = size; | |||
fFormat = format; | |||
fType = type; | |||
} | |||
bool Image::isValid() const noexcept | |||
{ | |||
return (fRawData != nullptr && getWidth() > 0 && getHeight() > 0); | |||
} | |||
int Image::getWidth() const noexcept | |||
{ | |||
return fSize.getWidth(); | |||
} | |||
int Image::getHeight() const noexcept | |||
{ | |||
return fSize.getHeight(); | |||
} | |||
const Size<int>& Image::getSize() const noexcept | |||
{ | |||
return fSize; | |||
} | |||
const char* Image::getRawData() const noexcept | |||
{ | |||
return fRawData; | |||
} | |||
GLenum Image::getFormat() const noexcept | |||
{ | |||
return fFormat; | |||
} | |||
GLenum Image::getType() const noexcept | |||
{ | |||
return fType; | |||
} | |||
void Image::draw() | |||
{ | |||