@@ -73,8 +73,11 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ() | |||
fKnobLowMid->setCallback(this); | |||
// knob Mid-High | |||
fKnobMidHigh = new ImageKnob(*fKnobLowMid); | |||
fKnobMidHigh = new ImageKnob(win, knobImage); | |||
fKnobMidHigh->setPos(160, 270); | |||
fKnobMidHigh->setRange(1000.0f, 20000.0f); | |||
fKnobMidHigh->setValue(2000.0f); | |||
fKnobMidHigh->setCallback(this); | |||
// about button | |||
Image aboutImageNormal(DistrhoArtwork3BandEQ::aboutButtonNormalData, DistrhoArtwork3BandEQ::aboutButtonNormalWidth, DistrhoArtwork3BandEQ::aboutButtonNormalHeight); | |||
@@ -210,6 +213,11 @@ void DistrhoUI3BandEQ::imageSliderValueChanged(ImageSlider* slider, float value) | |||
d_setParameterValue(DistrhoPlugin3BandEQ::paramMaster, value); | |||
} | |||
void DistrhoUI3BandEQ::onDisplay() | |||
{ | |||
fImgBackground.draw(); | |||
} | |||
// ------------------------------------------------- | |||
UI* createUI() | |||
@@ -70,6 +70,8 @@ protected: | |||
void imageSliderDragFinished(ImageSlider* slider); | |||
void imageSliderValueChanged(ImageSlider* slider, float value); | |||
void onDisplay(); | |||
private: | |||
Image fImgBackground; | |||
@@ -83,16 +83,16 @@ $(STATIC): $(OBJS) | |||
# -------------------------------------------------------------- | |||
distrho-3bandeq.cpp.o: distrho-3bandeq.cpp | |||
distrho-3bandeq.cpp.o: distrho-3bandeq.cpp 3bandeq/DistrhoArtwork3BandEQ.cpp 3bandeq/DistrhoPlugin3BandEQ.cpp 3bandeq/DistrhoUI3BandEQ.cpp distrho/DistrhoPluginCarla.cpp | |||
$(CXX) $< $(BUILD_CXX_FLAGS) -I3bandeq -DDISTRHO_NAMESPACE=DISTRHO_3BandEQ -c -o $@ | |||
distrho-3bandsplitter.cpp.o: distrho-3bandsplitter.cpp | |||
distrho-3bandsplitter.cpp.o: distrho-3bandsplitter.cpp distrho/DistrhoPluginCarla.cpp | |||
$(CXX) $< $(BUILD_CXX_FLAGS) -I3bandsplitter -DDISTRHO_NAMESPACE=DISTRHO_3BandSplitter -c -o $@ | |||
distrho-pingpongpan.cpp.o: distrho-pingpongpan.cpp | |||
distrho-pingpongpan.cpp.o: distrho-pingpongpan.cpp distrho/DistrhoPluginCarla.cpp | |||
$(CXX) $< $(BUILD_CXX_FLAGS) -Ipingpongpan -DDISTRHO_NAMESPACE=DISTRHO_PingPongPan -c -o $@ | |||
distrho-notes.cpp.o: distrho-notes.cpp moc_DistrhoUINotes.cpp moc_ParamProgressBar.cpp | |||
distrho-notes.cpp.o: distrho-notes.cpp distrho/DistrhoPluginCarla.cpp moc_DistrhoUINotes.cpp moc_ParamProgressBar.cpp | |||
$(CXX) $< $(BUILD_CXX_FLAGS) -Inotes -DDISTRHO_NAMESPACE=DISTRHO_Notes -c -o $@ | |||
zynaddsubfx.cpp.o: zynaddsubfx.cpp | |||
@@ -19,9 +19,6 @@ | |||
#include "DistrhoPluginMain.cpp" | |||
// TODO | |||
//#undef DISTRHO_PLUGIN_HAS_UI | |||
#if DISTRHO_PLUGIN_HAS_UI | |||
#include <QtGui/QMainWindow> | |||
#include "DistrhoUIMain.cpp" | |||
@@ -46,8 +43,9 @@ public: | |||
fUi(this, (intptr_t)fWidget.winId(), editParameterCallback, setParameterCallback, setStateCallback, sendNoteCallback, uiResizeCallback) | |||
{ | |||
setCentralWidget(&fWidget); | |||
setFixedSize(fUi.width(), fUi.height()); | |||
setWindowTitle(fUi.name()); | |||
setWindowTitle(QString("%1 (GUI)").arg(fUi.name())); | |||
uiResize(fUi.width(), fUi.height()); | |||
} | |||
~UICarla() | |||
@@ -119,6 +117,7 @@ protected: | |||
void uiResize(unsigned int width, unsigned int height) | |||
{ | |||
fWidget.setFixedSize(width, height); | |||
setFixedSize(width, height); | |||
} | |||
@@ -223,7 +222,7 @@ protected: | |||
param.scalePoints = nullptr; | |||
{ | |||
int nativeParamHints = 0; | |||
int nativeParamHints = ::PARAMETER_IS_ENABLED; | |||
const uint32_t paramHints = fPlugin.parameterHints(index); | |||
if (paramHints & PARAMETER_IS_AUTOMABLE) | |||
@@ -1526,6 +1526,82 @@ public: | |||
} | |||
} | |||
// ------------------------------------------------------------------- | |||
// Post-poned events | |||
void uiParameterChange(const uint32_t index, const float value) | |||
{ | |||
CARLA_ASSERT(fDescriptor != nullptr); | |||
CARLA_ASSERT(fHandle != nullptr); | |||
CARLA_ASSERT(index < kData->param.count); | |||
if (! fIsUiVisible) | |||
return; | |||
if (fDescriptor == nullptr || fHandle == nullptr) | |||
return; | |||
if (index >= kData->param.count) | |||
return; | |||
fDescriptor->ui_set_parameter_value(fHandle, index, value); | |||
} | |||
void uiMidiProgramChange(const uint32_t index) | |||
{ | |||
CARLA_ASSERT(fDescriptor != nullptr); | |||
CARLA_ASSERT(fHandle != nullptr); | |||
CARLA_ASSERT(index < kData->midiprog.count); | |||
if (! fIsUiVisible) | |||
return; | |||
if (fDescriptor == nullptr || fHandle == nullptr) | |||
return; | |||
if (index >= kData->midiprog.count) | |||
return; | |||
fDescriptor->ui_set_parameter_value(fHandle, kData->midiprog.data[index].bank, kData->midiprog.data[index].program); | |||
} | |||
void uiNoteOn(const uint8_t channel, const uint8_t note, const uint8_t velo) | |||
{ | |||
CARLA_ASSERT(fDescriptor != nullptr); | |||
CARLA_ASSERT(fHandle != nullptr); | |||
CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); | |||
CARLA_ASSERT(note < MAX_MIDI_NOTE); | |||
CARLA_ASSERT(velo > 0 && velo < MAX_MIDI_VALUE); | |||
if (! fIsUiVisible) | |||
return; | |||
if (fDescriptor == nullptr || fHandle == nullptr) | |||
return; | |||
if (channel >= MAX_MIDI_CHANNELS) | |||
return; | |||
if (note >= MAX_MIDI_NOTE) | |||
return; | |||
if (velo >= MAX_MIDI_VALUE) | |||
return; | |||
// TODO | |||
} | |||
void uiNoteOff(const uint8_t channel, const uint8_t note) | |||
{ | |||
CARLA_ASSERT(fDescriptor != nullptr); | |||
CARLA_ASSERT(fHandle != nullptr); | |||
CARLA_ASSERT(channel < MAX_MIDI_CHANNELS); | |||
CARLA_ASSERT(note < MAX_MIDI_NOTE); | |||
if (! fIsUiVisible) | |||
return; | |||
if (fDescriptor == nullptr || fHandle == nullptr) | |||
return; | |||
if (channel >= MAX_MIDI_CHANNELS) | |||
return; | |||
if (note >= MAX_MIDI_NOTE) | |||
return; | |||
// TODO | |||
} | |||
// ------------------------------------------------------------------- | |||
// Cleanup | |||
@@ -45,6 +45,6 @@ rtmempool_%.a: | |||
clean: | |||
rm -f *.a *.def *.dll *.so | |||
$(MAKE) clean -C dgl | |||
$(MAKE) clean -C distrho/dgl | |||
$(MAKE) clean -C lilv | |||
$(MAKE) clean -C rtmempool |
@@ -17,7 +17,6 @@ | |||
#include "AppPrivate.hpp" | |||
#include "../Window.hpp" | |||
#include "../../DistrhoUtils.hpp" | |||
START_NAMESPACE_DGL | |||
@@ -122,11 +122,11 @@ void ImageSlider::onDisplay() | |||
if (fStartPos.getX() == fEndPos.getX()) | |||
{ | |||
x = fStartPos.getX(); | |||
y = fStartPos.getY() + normValue*(fEndPos.getY()-fStartPos.getY()); | |||
y = fEndPos.getY() - normValue*(fEndPos.getY()-fStartPos.getY()); | |||
} | |||
else if (fStartPos.getY() == fEndPos.getY()) | |||
{ | |||
x = fStartPos.getX() + normValue*(fEndPos.getX()-fStartPos.getX()); | |||
x = fEndPos.getX() - normValue*(fEndPos.getX()-fStartPos.getX()); | |||
y = fStartPos.getY(); | |||
} | |||
else | |||
@@ -160,7 +160,7 @@ bool ImageSlider::onMouse(int button, bool press, int x, int y) | |||
else | |||
return false; | |||
float value = vper * (fMaximum - fMinimum) + fMinimum; | |||
float value = fMaximum - vper * (fMaximum - fMinimum); | |||
if (value < fMinimum) | |||
value = fMinimum; | |||
@@ -212,7 +212,7 @@ bool ImageSlider::onMotion(int x, int y) | |||
vper = float(y - fSliderArea.getY()) / float(fSliderArea.getHeight()); | |||
} | |||
float value = vper * (fMaximum - fMinimum) + fMinimum; | |||
float value = fMaximum - vper * (fMaximum - fMinimum); | |||
if (value < fMinimum) | |||
value = fMinimum; | |||
@@ -223,11 +223,11 @@ bool ImageSlider::onMotion(int x, int y) | |||
} | |||
else if (y < fSliderArea.getY()) | |||
{ | |||
setValue(horizontal ? fMaximum : fMinimum, true); | |||
setValue(fMaximum, true); | |||
} | |||
else | |||
{ | |||
setValue(horizontal ? fMinimum : fMaximum, true); | |||
setValue(fMinimum, true); | |||
} | |||
return true; | |||
@@ -18,6 +18,7 @@ | |||
#include "../Widget.hpp" | |||
#include "../Window.hpp" | |||
#include <cassert> | |||
#include <cstdio> | |||
START_NAMESPACE_DGL | |||
@@ -29,11 +30,14 @@ Widget::Widget(Window* parent) | |||
: fParent(parent), | |||
fVisible(true) | |||
{ | |||
assert(parent != nullptr); | |||
parent->addWidget(this); | |||
} | |||
Widget::~Widget() | |||
{ | |||
fParent->removeWidget(this); | |||
} | |||
bool Widget::isVisible() | |||
@@ -212,6 +216,7 @@ bool Widget::onSpecial(bool, Key) | |||
void Widget::onReshape(int width, int height) | |||
{ | |||
printf("Reshape(%i, %i)\n", width, height); | |||
glEnable(GL_BLEND); | |||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | |||
glMatrixMode(GL_PROJECTION); | |||
@@ -39,6 +39,8 @@ | |||
START_NAMESPACE_DGL | |||
Window* dgl_lastUiParent = nullptr; | |||
// ------------------------------------------------- | |||
// Window Private | |||
@@ -49,10 +51,10 @@ public: | |||
: kApp(app), | |||
kAppPriv(appPriv), | |||
kSelf(self), | |||
kView(puglCreate(parentId, "Window", 600, 500, false, false)), | |||
kView(puglCreate(parentId, "Window", 600, 500, (parentId != 0), (parentId != 0))), | |||
fParent(parent), | |||
fChildFocus(nullptr), | |||
fVisible(false), | |||
fVisible((parentId != 0)), | |||
fClosed(false), | |||
fResizable(false), | |||
#if DGL_OS_WINDOWS | |||
@@ -491,11 +493,13 @@ private: | |||
Window::Window(App* app, Window* parent) | |||
: kPrivate(new Private(this, app, app->kPrivate, (parent != nullptr) ? parent->kPrivate : nullptr)) | |||
{ | |||
dgl_lastUiParent = this; | |||
} | |||
Window::Window(App* app, intptr_t parentId) | |||
: kPrivate(new Private(this, app, app->kPrivate, nullptr, parentId)) | |||
{ | |||
dgl_lastUiParent = this; | |||
} | |||
Window::~Window() | |||
@@ -34,6 +34,8 @@ | |||
# endif | |||
#endif | |||
#include <cassert> | |||
START_NAMESPACE_DISTRHO | |||
// ------------------------------------------------- | |||
@@ -44,10 +46,7 @@ typedef void (*setStateFunc) (void* ptr, const char* key, const char* value); | |||
typedef void (*sendNoteFunc) (void* ptr, bool onOff, uint8_t channel, uint8_t note, uint8_t velo); | |||
typedef void (*uiResizeFunc) (void* ptr, unsigned int width, unsigned int height); | |||
extern double d_lastUiSampleRate; | |||
#ifdef DISTRHO_UI_OPENGL | |||
extern Window* d_lastUiParent; | |||
#endif | |||
extern double d_lastUiSampleRate; | |||
// ------------------------------------------------- | |||
@@ -144,7 +143,8 @@ public: | |||
: qtGrip(nullptr), | |||
qtWidget(nullptr), | |||
#else | |||
: glWindow(createWindow(winId)), | |||
: glApp(), | |||
glWindow(&glApp, winId), | |||
#endif | |||
kUi(createUI()), | |||
kData((kUi != nullptr) ? kUi->pData : nullptr) | |||
@@ -171,7 +171,9 @@ public: | |||
{ | |||
if (kUi != nullptr) | |||
{ | |||
#ifdef DISTRHO_UI_QT4 | |||
destroyWindow(); | |||
#endif | |||
delete kUi; | |||
} | |||
} | |||
@@ -240,10 +242,11 @@ public: | |||
void idle() | |||
{ | |||
assert(kUi != nullptr); | |||
if (kUi != nullptr) | |||
kUi->d_uiIdle(); | |||
#ifdef DISTRHO_UI_QT4 | |||
kUi->d_uiIdle(); | |||
#else | |||
glApp.idle(); | |||
#endif | |||
} | |||
intptr_t getWinId() | |||
@@ -252,8 +255,7 @@ public: | |||
assert(qtWidget != nullptr); | |||
return (qtWidget != nullptr) ? qtWidget->winId() : 0; | |||
#else | |||
assert(glWindow != nullptr); | |||
return (glWindow != nullptr) ? glWindow->getWindowId() : 0; | |||
return glWindow.getWindowId(); | |||
#endif | |||
} | |||
@@ -264,7 +266,6 @@ public: | |||
{ | |||
assert(kUi != nullptr); | |||
assert(kData != nullptr); | |||
assert(kData->widget != nullptr); | |||
assert(qtGrip == nullptr); | |||
assert(qtWidget == nullptr); | |||
@@ -284,7 +285,7 @@ public: | |||
// set layout | |||
qtWidget->setLayout(new QVBoxLayout(qtWidget)); | |||
qtWidget->layout()->addWidget(kData->widget); | |||
qtWidget->layout()->addWidget(qt4Ui); | |||
qtWidget->layout()->setContentsMargins(0, 0, 0, 0); | |||
qtWidget->setFixedSize(kUi->d_width(), kUi->d_height()); | |||
@@ -310,20 +311,10 @@ public: | |||
// show it | |||
qtWidget->show(); | |||
} | |||
#else | |||
Window* createWindow(intptr_t parent) | |||
{ | |||
Window* window = new Window(&glApp, parent); | |||
d_lastUiParent = window; | |||
return window; | |||
} | |||
#endif | |||
void destroyWindow() | |||
{ | |||
#ifdef DISTRHO_UI_QT4 | |||
assert(kData != nullptr); | |||
assert(kData->widget != nullptr); | |||
assert(qtWidget != nullptr); | |||
if (kData == nullptr) | |||
@@ -351,20 +342,8 @@ public: | |||
delete qtWidget; | |||
qtWidget = nullptr; | |||
#else | |||
assert(kData != nullptr); | |||
assert(glWindow != nullptr); | |||
if (kData == nullptr) | |||
return; | |||
if (glWindow == nullptr) | |||
return; | |||
glWindow->hide(); | |||
delete glWindow; | |||
glWindow = nullptr; | |||
#endif | |||
} | |||
#endif | |||
// --------------------------------------------- | |||
@@ -373,8 +352,8 @@ private: | |||
QSizeGrip* qtGrip; | |||
QEmbedWidget* qtWidget; | |||
#else | |||
App glApp; | |||
Window* glWindow; | |||
App glApp; | |||
Window glWindow; | |||
#endif | |||
protected: | |||
@@ -386,8 +365,7 @@ protected: | |||
{ | |||
assert(kUi != nullptr); | |||
assert(kData != nullptr); | |||
assert(kData->widget != nullptr); | |||
assert(qtGrip != nullptr); | |||
//assert(qtGrip != nullptr); | |||
assert(qtWidget != nullptr); | |||
if (kUi == nullptr) | |||
@@ -16,21 +16,22 @@ | |||
#include "DistrhoUIInternal.hpp" | |||
START_NAMESPACE_DISTRHO | |||
// ------------------------------------------------- | |||
// Static data | |||
START_NAMESPACE_DGL | |||
extern Window* dgl_lastUiParent; | |||
END_NAMESPACE_DGL | |||
Window* d_lastParent = nullptr; | |||
START_NAMESPACE_DISTRHO | |||
// ------------------------------------------------- | |||
// OpenGLUI | |||
OpenGLUI::OpenGLUI() | |||
: UI(), | |||
Widget(d_lastParent) | |||
Widget(dgl_lastUiParent) | |||
{ | |||
d_lastParent = nullptr; | |||
assert(dgl_lastUiParent != nullptr); | |||
dgl_lastUiParent = nullptr; | |||
} | |||
OpenGLUI::~OpenGLUI() | |||