Revert "Make UI code cairo compatible"
This reverts commit 3fce1eb8b0
.
Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
parent
564a070e42
commit
b5aa7b7c13
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
|
||||
* Copyright (C) 2013-2021 Filipe Coelho <falktx@falktx.com>
|
||||
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
|
@ -26,17 +26,17 @@ namespace Art = DistrhoArtworkNekobi;
|
|||
|
||||
DistrhoUINekobi::DistrhoUINekobi()
|
||||
: UI(Art::backgroundWidth, Art::backgroundHeight),
|
||||
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, kImageFormatBGR),
|
||||
fImgBackground(Art::backgroundData, Art::backgroundWidth, Art::backgroundHeight, GL_BGR),
|
||||
fAboutWindow(this)
|
||||
{
|
||||
// about
|
||||
NekoImage aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, kImageFormatBGR);
|
||||
Image aboutImage(Art::aboutData, Art::aboutWidth, Art::aboutHeight, GL_BGR);
|
||||
fAboutWindow.setImage(aboutImage);
|
||||
|
||||
// slider
|
||||
NekoImage sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight, kImageFormatBGRA);
|
||||
Image sliderImage(Art::sliderData, Art::sliderWidth, Art::sliderHeight);
|
||||
|
||||
fSliderWaveform = new NekoImageSlider(this, sliderImage);
|
||||
fSliderWaveform = new ImageSlider(this, sliderImage);
|
||||
fSliderWaveform->setId(DistrhoPluginNekobi::paramWaveform);
|
||||
fSliderWaveform->setStartPos(133, 40);
|
||||
fSliderWaveform->setEndPos(133, 60);
|
||||
|
@ -46,10 +46,10 @@ DistrhoUINekobi::DistrhoUINekobi()
|
|||
fSliderWaveform->setCallback(this);
|
||||
|
||||
// knobs
|
||||
NekoImage knobImage(Art::knobData, Art::knobWidth, Art::knobHeight, kImageFormatBGRA);
|
||||
Image knobImage(Art::knobData, Art::knobWidth, Art::knobHeight);
|
||||
|
||||
// knob Tuning
|
||||
fKnobTuning = new NekoImageKnob(this, knobImage, NekoImageKnob::Vertical);
|
||||
fKnobTuning = new ImageKnob(this, knobImage, ImageKnob::Vertical);
|
||||
fKnobTuning->setId(DistrhoPluginNekobi::paramTuning);
|
||||
fKnobTuning->setAbsolutePos(41, 43);
|
||||
fKnobTuning->setRange(-12.0f, 12.0f);
|
||||
|
@ -59,7 +59,7 @@ DistrhoUINekobi::DistrhoUINekobi()
|
|||
fKnobTuning->setCallback(this);
|
||||
|
||||
// knob Cutoff
|
||||
fKnobCutoff = new NekoImageKnob(this, knobImage, NekoImageKnob::Vertical);
|
||||
fKnobCutoff = new ImageKnob(this, knobImage, ImageKnob::Vertical);
|
||||
fKnobCutoff->setId(DistrhoPluginNekobi::paramCutoff);
|
||||
fKnobCutoff->setAbsolutePos(185, 43);
|
||||
fKnobCutoff->setRange(0.0f, 100.0f);
|
||||
|
@ -69,7 +69,7 @@ DistrhoUINekobi::DistrhoUINekobi()
|
|||
fKnobCutoff->setCallback(this);
|
||||
|
||||
// knob Resonance
|
||||
fKnobResonance = new NekoImageKnob(this, knobImage, NekoImageKnob::Vertical);
|
||||
fKnobResonance = new ImageKnob(this, knobImage, ImageKnob::Vertical);
|
||||
fKnobResonance->setId(DistrhoPluginNekobi::paramResonance);
|
||||
fKnobResonance->setAbsolutePos(257, 43);
|
||||
fKnobResonance->setRange(0.0f, 95.0f);
|
||||
|
@ -79,7 +79,7 @@ DistrhoUINekobi::DistrhoUINekobi()
|
|||
fKnobResonance->setCallback(this);
|
||||
|
||||
// knob Env Mod
|
||||
fKnobEnvMod = new NekoImageKnob(this, knobImage, NekoImageKnob::Vertical);
|
||||
fKnobEnvMod = new ImageKnob(this, knobImage, ImageKnob::Vertical);
|
||||
fKnobEnvMod->setId(DistrhoPluginNekobi::paramEnvMod);
|
||||
fKnobEnvMod->setAbsolutePos(329, 43);
|
||||
fKnobEnvMod->setRange(0.0f, 100.0f);
|
||||
|
@ -89,7 +89,7 @@ DistrhoUINekobi::DistrhoUINekobi()
|
|||
fKnobEnvMod->setCallback(this);
|
||||
|
||||
// knob Decay
|
||||
fKnobDecay = new NekoImageKnob(this, knobImage, NekoImageKnob::Vertical);
|
||||
fKnobDecay = new ImageKnob(this, knobImage, ImageKnob::Vertical);
|
||||
fKnobDecay->setId(DistrhoPluginNekobi::paramDecay);
|
||||
fKnobDecay->setAbsolutePos(400, 43);
|
||||
fKnobDecay->setRange(0.0f, 100.0f);
|
||||
|
@ -99,7 +99,7 @@ DistrhoUINekobi::DistrhoUINekobi()
|
|||
fKnobDecay->setCallback(this);
|
||||
|
||||
// knob Accent
|
||||
fKnobAccent = new NekoImageKnob(this, knobImage, NekoImageKnob::Vertical);
|
||||
fKnobAccent = new ImageKnob(this, knobImage, ImageKnob::Vertical);
|
||||
fKnobAccent->setId(DistrhoPluginNekobi::paramAccent);
|
||||
fKnobAccent->setAbsolutePos(473, 43);
|
||||
fKnobAccent->setRange(0.0f, 100.0f);
|
||||
|
@ -109,7 +109,7 @@ DistrhoUINekobi::DistrhoUINekobi()
|
|||
fKnobAccent->setCallback(this);
|
||||
|
||||
// knob Volume
|
||||
fKnobVolume = new NekoImageKnob(this, knobImage, NekoImageKnob::Vertical);
|
||||
fKnobVolume = new ImageKnob(this, knobImage, ImageKnob::Vertical);
|
||||
fKnobVolume->setId(DistrhoPluginNekobi::paramVolume);
|
||||
fKnobVolume->setAbsolutePos(545, 43);
|
||||
fKnobVolume->setRange(0.0f, 100.0f);
|
||||
|
@ -119,9 +119,9 @@ DistrhoUINekobi::DistrhoUINekobi()
|
|||
fKnobVolume->setCallback(this);
|
||||
|
||||
// about button
|
||||
NekoImage aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight, kImageFormatBGRA);
|
||||
NekoImage aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight, kImageFormatBGRA);
|
||||
fButtonAbout = new NekoImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
|
||||
Image aboutImageNormal(Art::aboutButtonNormalData, Art::aboutButtonNormalWidth, Art::aboutButtonNormalHeight);
|
||||
Image aboutImageHover(Art::aboutButtonHoverData, Art::aboutButtonHoverWidth, Art::aboutButtonHoverHeight);
|
||||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover);
|
||||
fButtonAbout->setAbsolutePos(505, 5);
|
||||
fButtonAbout->setCallback(this);
|
||||
|
||||
|
@ -166,50 +166,48 @@ void DistrhoUINekobi::parameterChanged(uint32_t index, float value)
|
|||
// -----------------------------------------------------------------------
|
||||
// Widget Callbacks
|
||||
|
||||
void DistrhoUINekobi::imageButtonClicked(NekoImageButton* button, int)
|
||||
void DistrhoUINekobi::imageButtonClicked(ImageButton* button, int)
|
||||
{
|
||||
if (button != fButtonAbout)
|
||||
return;
|
||||
|
||||
fAboutWindow.runAsModal();
|
||||
fAboutWindow.exec();
|
||||
}
|
||||
|
||||
void DistrhoUINekobi::imageKnobDragStarted(NekoImageKnob* knob)
|
||||
void DistrhoUINekobi::imageKnobDragStarted(ImageKnob* knob)
|
||||
{
|
||||
editParameter(knob->getId(), true);
|
||||
}
|
||||
|
||||
void DistrhoUINekobi::imageKnobDragFinished(NekoImageKnob* knob)
|
||||
void DistrhoUINekobi::imageKnobDragFinished(ImageKnob* knob)
|
||||
{
|
||||
editParameter(knob->getId(), false);
|
||||
}
|
||||
|
||||
void DistrhoUINekobi::imageKnobValueChanged(NekoImageKnob* knob, float value)
|
||||
void DistrhoUINekobi::imageKnobValueChanged(ImageKnob* knob, float value)
|
||||
{
|
||||
setParameterValue(knob->getId(), value);
|
||||
}
|
||||
|
||||
void DistrhoUINekobi::imageSliderDragStarted(NekoImageSlider* slider)
|
||||
void DistrhoUINekobi::imageSliderDragStarted(ImageSlider* slider)
|
||||
{
|
||||
editParameter(slider->getId(), true);
|
||||
}
|
||||
|
||||
void DistrhoUINekobi::imageSliderDragFinished(NekoImageSlider* slider)
|
||||
void DistrhoUINekobi::imageSliderDragFinished(ImageSlider* slider)
|
||||
{
|
||||
editParameter(slider->getId(), false);
|
||||
}
|
||||
|
||||
void DistrhoUINekobi::imageSliderValueChanged(NekoImageSlider* slider, float value)
|
||||
void DistrhoUINekobi::imageSliderValueChanged(ImageSlider* slider, float value)
|
||||
{
|
||||
setParameterValue(slider->getId(), value);
|
||||
}
|
||||
|
||||
void DistrhoUINekobi::onDisplay()
|
||||
{
|
||||
const GraphicsContext& context(getGraphicsContext());
|
||||
|
||||
fImgBackground.draw(context);
|
||||
fNeko.draw(context);
|
||||
fImgBackground.draw();
|
||||
fNeko.draw();
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* DISTRHO Nekobi Plugin, based on Nekobee by Sean Bolton and others.
|
||||
* Copyright (C) 2013-2021 Filipe Coelho <falktx@falktx.com>
|
||||
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
|
@ -20,29 +20,24 @@
|
|||
|
||||
#include "DistrhoUI.hpp"
|
||||
|
||||
#include "ImageWidgets.hpp"
|
||||
|
||||
#include "DistrhoArtworkNekobi.hpp"
|
||||
#include "NekoWidget.hpp"
|
||||
#include "ImageBaseWidgets.hpp"
|
||||
|
||||
#ifdef DGL_CAIRO
|
||||
typedef DGL_NAMESPACE::CairoImage NekoImage;
|
||||
#else
|
||||
typedef DGL_NAMESPACE::OpenGLImage NekoImage;
|
||||
#endif
|
||||
|
||||
typedef DGL_NAMESPACE::ImageBaseAboutWindow<NekoImage> NekoImageAboutWindow;
|
||||
typedef DGL_NAMESPACE::ImageBaseButton<NekoImage> NekoImageButton;
|
||||
typedef DGL_NAMESPACE::ImageBaseKnob<NekoImage> NekoImageKnob;
|
||||
typedef DGL_NAMESPACE::ImageBaseSlider<NekoImage> NekoImageSlider;
|
||||
using DGL_NAMESPACE::ImageAboutWindow;
|
||||
using DGL_NAMESPACE::ImageButton;
|
||||
using DGL_NAMESPACE::ImageKnob;
|
||||
using DGL_NAMESPACE::ImageSlider;
|
||||
|
||||
START_NAMESPACE_DISTRHO
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
class DistrhoUINekobi : public UI,
|
||||
public NekoImageButton::Callback,
|
||||
public NekoImageKnob::Callback,
|
||||
public NekoImageSlider::Callback,
|
||||
public ImageButton::Callback,
|
||||
public ImageKnob::Callback,
|
||||
public ImageSlider::Callback,
|
||||
public IdleCallback
|
||||
{
|
||||
public:
|
||||
|
@ -57,13 +52,13 @@ protected:
|
|||
// -------------------------------------------------------------------
|
||||
// Widget Callbacks
|
||||
|
||||
void imageButtonClicked(NekoImageButton* button, int) override;
|
||||
void imageKnobDragStarted(NekoImageKnob* knob) override;
|
||||
void imageKnobDragFinished(NekoImageKnob* knob) override;
|
||||
void imageKnobValueChanged(NekoImageKnob* knob, float value) override;
|
||||
void imageSliderDragStarted(NekoImageSlider* slider) override;
|
||||
void imageSliderDragFinished(NekoImageSlider* slider) override;
|
||||
void imageSliderValueChanged(NekoImageSlider* slider, float value) override;
|
||||
void imageButtonClicked(ImageButton* button, int) override;
|
||||
void imageKnobDragStarted(ImageKnob* knob) override;
|
||||
void imageKnobDragFinished(ImageKnob* knob) override;
|
||||
void imageKnobValueChanged(ImageKnob* knob, float value) override;
|
||||
void imageSliderDragStarted(ImageSlider* slider) override;
|
||||
void imageSliderDragFinished(ImageSlider* slider) override;
|
||||
void imageSliderValueChanged(ImageSlider* slider, float value) override;
|
||||
|
||||
void onDisplay() override;
|
||||
|
||||
|
@ -73,14 +68,14 @@ protected:
|
|||
void idleCallback() override;
|
||||
|
||||
private:
|
||||
NekoImage fImgBackground;
|
||||
NekoImageAboutWindow fAboutWindow;
|
||||
NekoWidget fNeko;
|
||||
Image fImgBackground;
|
||||
ImageAboutWindow fAboutWindow;
|
||||
NekoWidget fNeko;
|
||||
|
||||
ScopedPointer<NekoImageButton> fButtonAbout;
|
||||
ScopedPointer<NekoImageSlider> fSliderWaveform;
|
||||
ScopedPointer<NekoImageKnob> fKnobTuning, fKnobCutoff, fKnobResonance;
|
||||
ScopedPointer<NekoImageKnob> fKnobEnvMod, fKnobDecay, fKnobAccent, fKnobVolume;
|
||||
ScopedPointer<ImageButton> fButtonAbout;
|
||||
ScopedPointer<ImageSlider> fSliderWaveform;
|
||||
ScopedPointer<ImageKnob> fKnobTuning, fKnobCutoff, fKnobResonance;
|
||||
ScopedPointer<ImageKnob> fKnobEnvMod, fKnobDecay, fKnobAccent, fKnobVolume;
|
||||
|
||||
DISTRHO_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(DistrhoUINekobi)
|
||||
};
|
||||
|
|
|
@ -22,7 +22,6 @@ FILES_UI = \
|
|||
# --------------------------------------------------------------
|
||||
# Do some magic
|
||||
|
||||
# UI_TYPE = cairo
|
||||
include ../../dpf/Makefile.plugins.mk
|
||||
|
||||
# --------------------------------------------------------------
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* Neko widget animation
|
||||
* Copyright (C) 2013-2021 Filipe Coelho <falktx@falktx.com>
|
||||
* Copyright (C) 2013-2015 Filipe Coelho <falktx@falktx.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License as
|
||||
|
@ -20,16 +20,13 @@
|
|||
|
||||
#include "DistrhoArtworkNekobi.hpp"
|
||||
|
||||
#ifdef DGL_CAIRO
|
||||
#include "Cairo.hpp"
|
||||
typedef DGL_NAMESPACE::CairoImage NekoImage;
|
||||
#else
|
||||
#include "OpenGL.hpp"
|
||||
typedef DGL_NAMESPACE::OpenGLImage NekoImage;
|
||||
#endif
|
||||
#include "Image.hpp"
|
||||
#include "Widget.hpp"
|
||||
|
||||
#include <cstdlib> // rand
|
||||
|
||||
using DGL_NAMESPACE::Image;
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
||||
class NekoWidget
|
||||
|
@ -64,7 +61,7 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void draw(const GraphicsContext& context)
|
||||
void draw()
|
||||
{
|
||||
int x = fPos+108;
|
||||
int y = -2;
|
||||
|
@ -75,7 +72,7 @@ public:
|
|||
y += 12;
|
||||
}
|
||||
|
||||
fCurImage->drawAt(context, x, y);
|
||||
fCurImage->drawAt(x, y);
|
||||
}
|
||||
|
||||
// returns true if needs repaint
|
||||
|
@ -170,23 +167,23 @@ private:
|
|||
};
|
||||
|
||||
struct Images {
|
||||
NekoImage sit;
|
||||
NekoImage tail;
|
||||
NekoImage claw1;
|
||||
NekoImage claw2;
|
||||
NekoImage scratch1;
|
||||
NekoImage scratch2;
|
||||
NekoImage run1;
|
||||
NekoImage run2;
|
||||
NekoImage run3;
|
||||
NekoImage run4;
|
||||
Image sit;
|
||||
Image tail;
|
||||
Image claw1;
|
||||
Image claw2;
|
||||
Image scratch1;
|
||||
Image scratch2;
|
||||
Image run1;
|
||||
Image run2;
|
||||
Image run3;
|
||||
Image run4;
|
||||
} fImages;
|
||||
|
||||
int fPos;
|
||||
int fTimer;
|
||||
|
||||
Action fCurAction;
|
||||
NekoImage* fCurImage;
|
||||
Image* fCurImage;
|
||||
};
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
|
Loading…
Reference in New Issue