@@ -74,8 +74,24 @@ def png2rgba(namespace, filenames): | |||
fdC.write(" %3u, %3u, %3u," % (b, g, r)) | |||
else: | |||
r, g, b, a = data | |||
#a -= 100 | |||
#if a < 0: a = 0 | |||
if filename in ("artwork/claw1.png", | |||
"artwork/claw2.png", | |||
"artwork/run1.png", | |||
"artwork/run2.png", | |||
"artwork/run3.png", | |||
"artwork/run4.png", | |||
"artwork/scratch1.png", | |||
"artwork/scratch2.png", | |||
"artwork/sit.png", | |||
"artwork/tail.png"): | |||
if r == 255: | |||
a -= 38 | |||
if a < 0: a = 0 | |||
#a = 0 | |||
#else: | |||
#r = g = b = 255 | |||
fdC.write(" %3u, %3u, %3u, %3u," % (b, g, r, a)) | |||
if curColumn > 20: | |||
@@ -24,18 +24,20 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ() | |||
: OpenGLUI(), | |||
fAboutWindow(this) | |||
{ | |||
Window* win = getParent(); | |||
// background | |||
fImgBackground = Image(DistrhoArtwork3BandEQ::backgroundData, DistrhoArtwork3BandEQ::backgroundWidth, DistrhoArtwork3BandEQ::backgroundHeight, GL_BGR); | |||
// about | |||
Image imageAbout(DistrhoArtwork3BandEQ::aboutData, DistrhoArtwork3BandEQ::aboutWidth, DistrhoArtwork3BandEQ::aboutHeight, GL_BGR); | |||
fAboutWindow.setImage(imageAbout); | |||
// sliders | |||
Image sliderImage(DistrhoArtwork3BandEQ::sliderData, DistrhoArtwork3BandEQ::sliderWidth, DistrhoArtwork3BandEQ::sliderHeight); | |||
Point<int> sliderPosStart(57, 43); | |||
Point<int> sliderPosEnd(57, 43 + 160); | |||
// slider Low | |||
fSliderLow = new ImageSlider(win, sliderImage); | |||
fSliderLow = new ImageSlider(this, sliderImage); | |||
fSliderLow->setStartPos(sliderPosStart); | |||
fSliderLow->setEndPos(sliderPosEnd); | |||
fSliderLow->setRange(-24.0f, 24.0f); | |||
@@ -67,14 +69,14 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ() | |||
Image knobImage(DistrhoArtwork3BandEQ::knobData, DistrhoArtwork3BandEQ::knobWidth, DistrhoArtwork3BandEQ::knobHeight); | |||
// knob Low-Mid | |||
fKnobLowMid = new ImageKnob(win, knobImage); | |||
fKnobLowMid = new ImageKnob(this, knobImage); | |||
fKnobLowMid->setPos(66, 270); | |||
fKnobLowMid->setRange(0.0f, 1000.0f); | |||
fKnobLowMid->setValue(220.0f); | |||
fKnobLowMid->setCallback(this); | |||
// knob Mid-High | |||
fKnobMidHigh = new ImageKnob(win, knobImage); | |||
fKnobMidHigh = new ImageKnob(this, knobImage); | |||
fKnobMidHigh->setPos(160, 270); | |||
fKnobMidHigh->setRange(1000.0f, 20000.0f); | |||
fKnobMidHigh->setValue(2000.0f); | |||
@@ -83,7 +85,7 @@ DistrhoUI3BandEQ::DistrhoUI3BandEQ() | |||
// about button | |||
Image aboutImageNormal(DistrhoArtwork3BandEQ::aboutButtonNormalData, DistrhoArtwork3BandEQ::aboutButtonNormalWidth, DistrhoArtwork3BandEQ::aboutButtonNormalHeight); | |||
Image aboutImageHover(DistrhoArtwork3BandEQ::aboutButtonHoverData, DistrhoArtwork3BandEQ::aboutButtonHoverWidth, DistrhoArtwork3BandEQ::aboutButtonHoverHeight); | |||
fButtonAbout = new ImageButton(win, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setPos(264, 300); | |||
fButtonAbout->setCallback(this); | |||
} | |||
@@ -149,8 +151,6 @@ void DistrhoUI3BandEQ::imageButtonClicked(ImageButton* button, int) | |||
if (button != fButtonAbout) | |||
return; | |||
Image imageAbout(DistrhoArtwork3BandEQ::aboutData, DistrhoArtwork3BandEQ::aboutWidth, DistrhoArtwork3BandEQ::aboutHeight, GL_BGR); | |||
fAboutWindow.setImage(imageAbout); | |||
fAboutWindow.exec(); | |||
} | |||
@@ -18,6 +18,7 @@ | |||
#define __DISTRHO_UI_3BANDEQ_HPP__ | |||
#include "DistrhoUIOpenGL.hpp" | |||
#include "dgl/ImageAboutWindow.hpp" | |||
#include "dgl/ImageButton.hpp" | |||
#include "dgl/ImageKnob.hpp" | |||
@@ -37,18 +38,18 @@ class DistrhoUI3BandEQ : public OpenGLUI, | |||
{ | |||
public: | |||
DistrhoUI3BandEQ(); | |||
~DistrhoUI3BandEQ(); | |||
~DistrhoUI3BandEQ() override; | |||
protected: | |||
// --------------------------------------------- | |||
// Information | |||
unsigned int d_width() const | |||
unsigned int d_width() const override | |||
{ | |||
return DistrhoArtwork3BandEQ::backgroundWidth; | |||
} | |||
unsigned int d_height() const | |||
unsigned int d_height() const override | |||
{ | |||
return DistrhoArtwork3BandEQ::backgroundHeight; | |||
} | |||
@@ -56,21 +57,21 @@ protected: | |||
// --------------------------------------------- | |||
// DSP Callbacks | |||
void d_parameterChanged(uint32_t index, float value); | |||
void d_programChanged(uint32_t index); | |||
void d_parameterChanged(uint32_t index, float value) override; | |||
void d_programChanged(uint32_t index) override; | |||
// --------------------------------------------- | |||
// Widget Callbacks | |||
void imageButtonClicked(ImageButton* button, int); | |||
void imageKnobDragStarted(ImageKnob* knob); | |||
void imageKnobDragFinished(ImageKnob* knob); | |||
void imageKnobValueChanged(ImageKnob* knob, float value); | |||
void imageSliderDragStarted(ImageSlider* slider); | |||
void imageSliderDragFinished(ImageSlider* slider); | |||
void imageSliderValueChanged(ImageSlider* slider, float value); | |||
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(); | |||
void onDisplay() override; | |||
private: | |||
Image fImgBackground; | |||
@@ -16,27 +16,28 @@ | |||
#include "DistrhoUI3BandSplitter.hpp" | |||
#include "dgl/ImageAboutWindow.hpp" | |||
START_NAMESPACE_DISTRHO | |||
// ------------------------------------------------- | |||
DistrhoUI3BandSplitter::DistrhoUI3BandSplitter() | |||
: OpenGLUI() | |||
: OpenGLUI(), | |||
fAboutWindow(this) | |||
{ | |||
Window* win = getParent(); | |||
// background | |||
fImgBackground = Image(DistrhoArtwork3BandSplitter::backgroundData, DistrhoArtwork3BandSplitter::backgroundWidth, DistrhoArtwork3BandSplitter::backgroundHeight, GL_BGR); | |||
// about | |||
Image imageAbout(DistrhoArtwork3BandSplitter::aboutData, DistrhoArtwork3BandSplitter::aboutWidth, DistrhoArtwork3BandSplitter::aboutHeight, GL_BGR); | |||
fAboutWindow.setImage(imageAbout); | |||
// sliders | |||
Image sliderImage(DistrhoArtwork3BandSplitter::sliderData, DistrhoArtwork3BandSplitter::sliderWidth, DistrhoArtwork3BandSplitter::sliderHeight); | |||
Point<int> sliderPosStart(57, 43); | |||
Point<int> sliderPosEnd(57, 43 + 160); | |||
// slider Low | |||
fSliderLow = new ImageSlider(win, sliderImage); | |||
fSliderLow = new ImageSlider(this, sliderImage); | |||
fSliderLow->setStartPos(sliderPosStart); | |||
fSliderLow->setEndPos(sliderPosEnd); | |||
fSliderLow->setRange(-24.0f, 24.0f); | |||
@@ -68,14 +69,14 @@ DistrhoUI3BandSplitter::DistrhoUI3BandSplitter() | |||
Image knobImage(DistrhoArtwork3BandSplitter::knobData, DistrhoArtwork3BandSplitter::knobWidth, DistrhoArtwork3BandSplitter::knobHeight); | |||
// knob Low-Mid | |||
fKnobLowMid = new ImageKnob(win, knobImage); | |||
fKnobLowMid = new ImageKnob(this, knobImage); | |||
fKnobLowMid->setPos(66, 270); | |||
fKnobLowMid->setRange(0.0f, 1000.0f); | |||
fKnobLowMid->setValue(220.0f); | |||
fKnobLowMid->setCallback(this); | |||
// knob Mid-High | |||
fKnobMidHigh = new ImageKnob(win, knobImage); | |||
fKnobMidHigh = new ImageKnob(this, knobImage); | |||
fKnobMidHigh->setPos(160, 270); | |||
fKnobMidHigh->setRange(1000.0f, 20000.0f); | |||
fKnobMidHigh->setValue(2000.0f); | |||
@@ -84,7 +85,7 @@ DistrhoUI3BandSplitter::DistrhoUI3BandSplitter() | |||
// about button | |||
Image aboutImageNormal(DistrhoArtwork3BandSplitter::aboutButtonNormalData, DistrhoArtwork3BandSplitter::aboutButtonNormalWidth, DistrhoArtwork3BandSplitter::aboutButtonNormalHeight); | |||
Image aboutImageHover(DistrhoArtwork3BandSplitter::aboutButtonHoverData, DistrhoArtwork3BandSplitter::aboutButtonHoverWidth, DistrhoArtwork3BandSplitter::aboutButtonHoverHeight); | |||
fButtonAbout = new ImageButton(win, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setPos(264, 300); | |||
fButtonAbout->setCallback(this); | |||
} | |||
@@ -150,9 +151,7 @@ void DistrhoUI3BandSplitter::imageButtonClicked(ImageButton* button, int) | |||
if (button != fButtonAbout) | |||
return; | |||
Image imageAbout(DistrhoArtwork3BandSplitter::aboutData, DistrhoArtwork3BandSplitter::aboutWidth, DistrhoArtwork3BandSplitter::aboutHeight, GL_BGR); | |||
ImageAboutWindow aboutWindow(getApp(), getParent(), imageAbout); | |||
aboutWindow.exec(); | |||
fAboutWindow.exec(); | |||
} | |||
void DistrhoUI3BandSplitter::imageKnobDragStarted(ImageKnob* knob) | |||
@@ -171,7 +170,6 @@ void DistrhoUI3BandSplitter::imageKnobDragFinished(ImageKnob* knob) | |||
d_editParameter(DistrhoPlugin3BandSplitter::paramMidHighFreq, false); | |||
} | |||
void DistrhoUI3BandSplitter::imageKnobValueChanged(ImageKnob* knob, float value) | |||
{ | |||
if (knob == fKnobLowMid) | |||
@@ -18,6 +18,8 @@ | |||
#define __DISTRHO_UI_3BANDSPLITTER_HPP__ | |||
#include "DistrhoUIOpenGL.hpp" | |||
#include "dgl/ImageAboutWindow.hpp" | |||
#include "dgl/ImageButton.hpp" | |||
#include "dgl/ImageKnob.hpp" | |||
#include "dgl/ImageSlider.hpp" | |||
@@ -36,19 +38,18 @@ class DistrhoUI3BandSplitter : public OpenGLUI, | |||
{ | |||
public: | |||
DistrhoUI3BandSplitter(); | |||
~DistrhoUI3BandSplitter(); | |||
~DistrhoUI3BandSplitter() override; | |||
protected: | |||
// --------------------------------------------- | |||
// Information | |||
unsigned int d_width() const | |||
unsigned int d_width() const override | |||
{ | |||
return DistrhoArtwork3BandSplitter::backgroundWidth; | |||
} | |||
unsigned int d_height() const | |||
unsigned int d_height() const override | |||
{ | |||
return DistrhoArtwork3BandSplitter::backgroundHeight; | |||
} | |||
@@ -56,24 +57,25 @@ protected: | |||
// --------------------------------------------- | |||
// DSP Callbacks | |||
void d_parameterChanged(uint32_t index, float value); | |||
void d_programChanged(uint32_t index); | |||
void d_parameterChanged(uint32_t index, float value) override; | |||
void d_programChanged(uint32_t index) override; | |||
// --------------------------------------------- | |||
// Widget Callbacks | |||
void imageButtonClicked(ImageButton* button, int); | |||
void imageKnobDragStarted(ImageKnob* knob); | |||
void imageKnobDragFinished(ImageKnob* knob); | |||
void imageKnobValueChanged(ImageKnob* knob, float value); | |||
void imageSliderDragStarted(ImageSlider* slider); | |||
void imageSliderDragFinished(ImageSlider* slider); | |||
void imageSliderValueChanged(ImageSlider* slider, float value); | |||
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(); | |||
void onDisplay() override; | |||
private: | |||
Image fImgBackground; | |||
ImageAboutWindow fAboutWindow; | |||
ImageSlider* fSliderLow; | |||
ImageSlider* fSliderMid; | |||
@@ -5,6 +5,16 @@ | |||
namespace DistrhoArtworkNekobi | |||
{ | |||
extern const char* aboutButtonHoverData; | |||
const unsigned int aboutButtonHoverDataSize = 7600; | |||
const unsigned int aboutButtonHoverWidth = 95; | |||
const unsigned int aboutButtonHoverHeight = 20; | |||
extern const char* aboutButtonNormalData; | |||
const unsigned int aboutButtonNormalDataSize = 7600; | |||
const unsigned int aboutButtonNormalWidth = 95; | |||
const unsigned int aboutButtonNormalHeight = 20; | |||
extern const char* backgroundData; | |||
const unsigned int backgroundDataSize = 206064; | |||
const unsigned int backgroundWidth = 636; | |||
@@ -21,9 +31,9 @@ namespace DistrhoArtworkNekobi | |||
const unsigned int claw2Height = 32; | |||
extern const char* knobData; | |||
const unsigned int knobDataSize = 288444; | |||
const unsigned int knobWidth = 43; | |||
const unsigned int knobHeight = 1677; | |||
const unsigned int knobDataSize = 390000; | |||
const unsigned int knobWidth = 50; | |||
const unsigned int knobHeight = 1950; | |||
extern const char* run1Data; | |||
const unsigned int run1DataSize = 4096; | |||
@@ -61,9 +71,9 @@ namespace DistrhoArtworkNekobi | |||
const unsigned int sitHeight = 32; | |||
extern const char* sliderData; | |||
const unsigned int sliderDataSize = 4624; | |||
const unsigned int sliderWidth = 34; | |||
const unsigned int sliderHeight = 34; | |||
const unsigned int sliderDataSize = 6084; | |||
const unsigned int sliderWidth = 39; | |||
const unsigned int sliderHeight = 39; | |||
extern const char* tailData; | |||
const unsigned int tailDataSize = 4096; | |||
@@ -24,21 +24,25 @@ START_NAMESPACE_DISTRHO | |||
// ------------------------------------------------- | |||
DistrhoUINekobi::DistrhoUINekobi() | |||
: OpenGLUI() | |||
: OpenGLUI(), | |||
fAboutWindow(this) | |||
{ | |||
Window* win = getParent(); | |||
// FIXME | |||
fNeko.setTimerSpeed(4); | |||
// background | |||
fImgBackground = Image(DistrhoArtworkNekobi::backgroundData, DistrhoArtworkNekobi::backgroundWidth, DistrhoArtworkNekobi::backgroundHeight, GL_BGR); | |||
// TODO - about png | |||
Image imageAbout(DistrhoArtworkNekobi::aboutButtonHoverData, DistrhoArtworkNekobi::aboutButtonHoverWidth, DistrhoArtworkNekobi::aboutButtonHoverHeight, GL_BGRA); | |||
fAboutWindow.setImage(imageAbout); | |||
// slider | |||
Image sliderImage(DistrhoArtworkNekobi::sliderData, DistrhoArtworkNekobi::sliderWidth, DistrhoArtworkNekobi::sliderHeight); | |||
fSliderWaveform = new ImageSlider(win, sliderImage); | |||
fSliderWaveform->setStartPos(135, 39); | |||
fSliderWaveform->setEndPos(135, 65); | |||
fSliderWaveform = new ImageSlider(this, sliderImage); | |||
fSliderWaveform->setStartPos(133, 38); | |||
fSliderWaveform->setEndPos(133, 64); | |||
fSliderWaveform->setRange(0.0f, 1.0f); | |||
fSliderWaveform->setValue(0.0f); | |||
fSliderWaveform->setCallback(this); | |||
@@ -47,53 +51,60 @@ DistrhoUINekobi::DistrhoUINekobi() | |||
Image knobImage(DistrhoArtworkNekobi::knobData, DistrhoArtworkNekobi::knobWidth, DistrhoArtworkNekobi::knobHeight); | |||
// knob Tuning | |||
fKnobTuning = new ImageKnob(win, knobImage); | |||
fKnobTuning->setPos(44, 46); | |||
fKnobTuning = new ImageKnob(this, knobImage); | |||
fKnobTuning->setPos(42, 45); | |||
fKnobTuning->setRange(-12.0f, 12.0f); | |||
fKnobTuning->setValue(0.0f); | |||
fKnobTuning->setCallback(this); | |||
// knob Cutoff | |||
fKnobCutoff = new ImageKnob(win, knobImage); | |||
fKnobCutoff->setPos(187, 46); | |||
fKnobCutoff = new ImageKnob(this, knobImage); | |||
fKnobCutoff->setPos(185, 45); | |||
fKnobCutoff->setRange(0.0f, 100.0f); | |||
fKnobCutoff->setValue(25.0f); | |||
fKnobCutoff->setCallback(this); | |||
// knob Resonance | |||
fKnobResonance = new ImageKnob(win, knobImage); | |||
fKnobResonance->setPos(260, 46); | |||
fKnobResonance = new ImageKnob(this, knobImage); | |||
fKnobResonance->setPos(258, 45); | |||
fKnobResonance->setRange(0.0f, 95.0f); | |||
fKnobResonance->setValue(25.0f); | |||
fKnobResonance->setCallback(this); | |||
// knob Env Mod | |||
fKnobEnvMod = new ImageKnob(win, knobImage); | |||
fKnobEnvMod->setPos(332, 46); | |||
fKnobEnvMod = new ImageKnob(this, knobImage); | |||
fKnobEnvMod->setPos(330, 45); | |||
fKnobEnvMod->setRange(0.0f, 100.0f); | |||
fKnobEnvMod->setValue(50.0f); | |||
fKnobEnvMod->setCallback(this); | |||
// knob Decay | |||
fKnobDecay = new ImageKnob(win, knobImage); | |||
fKnobDecay->setPos(404, 46); | |||
fKnobDecay = new ImageKnob(this, knobImage); | |||
fKnobDecay->setPos(402, 45); | |||
fKnobDecay->setRange(0.0f, 100.0f); | |||
fKnobDecay->setValue(75.0f); | |||
fKnobDecay->setCallback(this); | |||
// knob Accent | |||
fKnobAccent = new ImageKnob(win, knobImage); | |||
fKnobAccent->setPos(476, 46); | |||
fKnobAccent = new ImageKnob(this, knobImage); | |||
fKnobAccent->setPos(474, 45); | |||
fKnobAccent->setRange(0.0f, 100.0f); | |||
fKnobAccent->setValue(25.0f); | |||
fKnobAccent->setCallback(this); | |||
// knob Volume | |||
fKnobVolume = new ImageKnob(win, knobImage); | |||
fKnobVolume->setPos(548, 46); | |||
fKnobVolume = new ImageKnob(this, knobImage); | |||
fKnobVolume->setPos(546, 45); | |||
fKnobVolume->setRange(0.0f, 100.0f); | |||
fKnobVolume->setValue(75.0f); | |||
fKnobVolume->setCallback(this); | |||
// about button | |||
Image aboutImageNormal(DistrhoArtworkNekobi::aboutButtonNormalData, DistrhoArtworkNekobi::aboutButtonNormalWidth, DistrhoArtworkNekobi::aboutButtonNormalHeight); | |||
Image aboutImageHover(DistrhoArtworkNekobi::aboutButtonHoverData, DistrhoArtworkNekobi::aboutButtonHoverWidth, DistrhoArtworkNekobi::aboutButtonHoverHeight); | |||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setPos(500, 5); | |||
fButtonAbout->setCallback(this); | |||
} | |||
DistrhoUINekobi::~DistrhoUINekobi() | |||
@@ -106,6 +117,7 @@ DistrhoUINekobi::~DistrhoUINekobi() | |||
delete fKnobDecay; | |||
delete fKnobAccent; | |||
delete fKnobVolume; | |||
delete fButtonAbout; | |||
} | |||
// ------------------------------------------------- | |||
@@ -155,7 +167,7 @@ void DistrhoUINekobi::d_programChanged(uint32_t index) | |||
fKnobEnvMod->setValue(50.0f); | |||
fKnobDecay->setValue(75.0f); | |||
fKnobAccent->setValue(25.0f); | |||
fKnobVolume->setValue(50.0f); | |||
fKnobVolume->setValue(75.0f); | |||
} | |||
void DistrhoUINekobi::d_noteReceived(bool onOff, uint8_t, uint8_t note, uint8_t) | |||
@@ -180,7 +192,10 @@ void DistrhoUINekobi::d_uiIdle() | |||
void DistrhoUINekobi::imageButtonClicked(ImageButton* button, int) | |||
{ | |||
(void)button; | |||
if (button != fButtonAbout) | |||
return; | |||
fAboutWindow.exec(); | |||
} | |||
void DistrhoUINekobi::imageKnobDragStarted(ImageKnob* knob) | |||
@@ -19,6 +19,8 @@ | |||
#define __DISTRHO_UI_3BANDEQ_HPP__ | |||
#include "DistrhoUIOpenGL.hpp" | |||
#include "dgl/ImageAboutWindow.hpp" | |||
#include "dgl/ImageButton.hpp" | |||
#include "dgl/ImageKnob.hpp" | |||
#include "dgl/ImageSlider.hpp" | |||
@@ -91,7 +93,9 @@ private: | |||
ImageKnob* fKnobAccent; | |||
ImageKnob* fKnobVolume; | |||
ImageButton* fButtonAbout; | |||
ImageSlider* fSliderWaveform; | |||
ImageAboutWindow fAboutWindow; | |||
}; | |||
// ------------------------------------------------- | |||
@@ -46,23 +46,23 @@ class DistrhoUINotes : public QtUI | |||
public: | |||
DistrhoUINotes(); | |||
~DistrhoUINotes(); | |||
~DistrhoUINotes() override; | |||
protected: | |||
// --------------------------------------------- | |||
// Information | |||
bool d_resizable() | |||
bool d_resizable() const override | |||
{ | |||
return true; | |||
} | |||
uint d_minimumWidth() | |||
uint d_minimumWidth() const override | |||
{ | |||
return 180; | |||
} | |||
uint d_minimumHeight() | |||
uint d_minimumHeight() const override | |||
{ | |||
return 150; | |||
} | |||
@@ -70,18 +70,18 @@ protected: | |||
// --------------------------------------------- | |||
// DSP Callbacks | |||
void d_parameterChanged(uint32_t index, float value); | |||
void d_stateChanged(const char* key, const char* value); | |||
void d_parameterChanged(uint32_t index, float value) override; | |||
void d_stateChanged(const char* key, const char* value) override; | |||
// --------------------------------------------- | |||
// UI Callbacks | |||
void d_uiIdle(); | |||
void d_uiIdle() override; | |||
// --------------------------------------------- | |||
// listen for resize events | |||
void resizeEvent(QResizeEvent*); | |||
void resizeEvent(QResizeEvent*) override; | |||
private slots: | |||
void buttonClicked(bool click); | |||
@@ -21,14 +21,14 @@ namespace DistrhoArtworkPingPongPan | |||
const unsigned int aboutButtonNormalHeight = 20; | |||
extern const char* backgroundData; | |||
const unsigned int backgroundDataSize = 150552; | |||
const unsigned int backgroundWidth = 369; | |||
const unsigned int backgroundHeight = 136; | |||
const unsigned int backgroundDataSize = 157080; | |||
const unsigned int backgroundWidth = 308; | |||
const unsigned int backgroundHeight = 170; | |||
extern const char* knobData; | |||
const unsigned int knobDataSize = 721344; | |||
const unsigned int knobWidth = 68; | |||
const unsigned int knobHeight = 2652; | |||
const unsigned int knobDataSize = 700284; | |||
const unsigned int knobWidth = 67; | |||
const unsigned int knobHeight = 2613; | |||
} | |||
#endif // BINARY_DISTRHOARTWORKPINGPONGPAN_HPP | |||
@@ -23,26 +23,29 @@ START_NAMESPACE_DISTRHO | |||
// ------------------------------------------------- | |||
DistrhoUIPingPongPan::DistrhoUIPingPongPan() | |||
: OpenGLUI() | |||
: OpenGLUI(), | |||
fAboutWindow(this) | |||
{ | |||
Window* win = getParent(); | |||
// background | |||
fImgBackground = Image(DistrhoArtworkPingPongPan::backgroundData, DistrhoArtworkPingPongPan::backgroundWidth, DistrhoArtworkPingPongPan::backgroundHeight, GL_BGR); | |||
// TODO - about png | |||
Image imageAbout(DistrhoArtworkPingPongPan::aboutButtonHoverData, DistrhoArtworkPingPongPan::aboutButtonHoverWidth, DistrhoArtworkPingPongPan::aboutButtonHoverHeight, GL_BGRA); | |||
fAboutWindow.setImage(imageAbout); | |||
// knobs | |||
Image knobImage(DistrhoArtworkPingPongPan::knobData, DistrhoArtworkPingPongPan::knobWidth, DistrhoArtworkPingPongPan::knobHeight); | |||
// knob Low-Mid | |||
fKnobFreq = new ImageKnob(win, knobImage); | |||
fKnobFreq->setPos(136, 30); | |||
fKnobFreq = new ImageKnob(this, knobImage); | |||
fKnobFreq->setPos(61, 59); | |||
fKnobFreq->setRange(0.0f, 100.0f); | |||
fKnobFreq->setValue(50.0f); | |||
fKnobFreq->setCallback(this); | |||
// knob Mid-High | |||
fKnobWidth = new ImageKnob(win, knobImage); | |||
fKnobWidth->setPos(258, 30); | |||
fKnobWidth = new ImageKnob(this, knobImage); | |||
fKnobWidth->setPos(183, 59); | |||
fKnobWidth->setRange(0.0f, 100.0f); | |||
fKnobWidth->setValue(75.0f); | |||
fKnobWidth->setCallback(this); | |||
@@ -50,8 +53,8 @@ DistrhoUIPingPongPan::DistrhoUIPingPongPan() | |||
// about button | |||
Image aboutImageNormal(DistrhoArtworkPingPongPan::aboutButtonNormalData, DistrhoArtworkPingPongPan::aboutButtonNormalWidth, DistrhoArtworkPingPongPan::aboutButtonNormalHeight); | |||
Image aboutImageHover(DistrhoArtworkPingPongPan::aboutButtonHoverData, DistrhoArtworkPingPongPan::aboutButtonHoverWidth, DistrhoArtworkPingPongPan::aboutButtonHoverHeight); | |||
fButtonAbout = new ImageButton(win, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setPos(25, 23); | |||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setPos(183, 8); | |||
fButtonAbout->setCallback(this); | |||
} | |||
@@ -96,9 +99,7 @@ void DistrhoUIPingPongPan::imageButtonClicked(ImageButton* button, int) | |||
if (button != fButtonAbout) | |||
return; | |||
Image imageAbout(DistrhoArtworkPingPongPan::aboutData, DistrhoArtworkPingPongPan::aboutWidth, DistrhoArtworkPingPongPan::aboutHeight, GL_BGR); | |||
ImageAboutWindow aboutWindow(getApp(), getParent(), imageAbout); | |||
aboutWindow.exec(); | |||
fAboutWindow.exec(); | |||
} | |||
void DistrhoUIPingPongPan::imageKnobDragStarted(ImageKnob* knob) | |||
@@ -18,6 +18,8 @@ | |||
#define __DISTRHO_UI_PINGPONGPAN_HPP__ | |||
#include "DistrhoUIOpenGL.hpp" | |||
#include "dgl/ImageAboutWindow.hpp" | |||
#include "dgl/ImageButton.hpp" | |||
#include "dgl/ImageKnob.hpp" | |||
@@ -34,19 +36,19 @@ class DistrhoUIPingPongPan : public OpenGLUI, | |||
{ | |||
public: | |||
DistrhoUIPingPongPan(); | |||
~DistrhoUIPingPongPan(); | |||
~DistrhoUIPingPongPan() override; | |||
protected: | |||
// --------------------------------------------- | |||
// Information | |||
unsigned int d_width() const | |||
unsigned int d_width() const override | |||
{ | |||
return DistrhoArtworkPingPongPan::backgroundWidth; | |||
} | |||
unsigned int d_height() const | |||
unsigned int d_height() const override | |||
{ | |||
return DistrhoArtworkPingPongPan::backgroundHeight; | |||
} | |||
@@ -54,21 +56,22 @@ protected: | |||
// --------------------------------------------- | |||
// DSP Callbacks | |||
void d_parameterChanged(uint32_t index, float value); | |||
void d_programChanged(uint32_t index); | |||
void d_parameterChanged(uint32_t index, float value) override; | |||
void d_programChanged(uint32_t index) override; | |||
// --------------------------------------------- | |||
// Widget Callbacks | |||
void imageButtonClicked(ImageButton* button, int); | |||
void imageKnobDragStarted(ImageKnob* knob); | |||
void imageKnobDragFinished(ImageKnob* knob); | |||
void imageKnobValueChanged(ImageKnob* knob, float value); | |||
void imageButtonClicked(ImageButton* button, int) override; | |||
void imageKnobDragStarted(ImageKnob* knob) override; | |||
void imageKnobDragFinished(ImageKnob* knob) override; | |||
void imageKnobValueChanged(ImageKnob* knob, float value) override; | |||
void onDisplay(); | |||
void onDisplay() override; | |||
private: | |||
Image fImgBackground; | |||
ImageAboutWindow fAboutWindow; | |||
ImageKnob* fKnobFreq; | |||
ImageKnob* fKnobWidth; | |||
@@ -23,29 +23,32 @@ START_NAMESPACE_DISTRHO | |||
// ------------------------------------------------- | |||
DistrhoUIStereoEnhancer::DistrhoUIStereoEnhancer() | |||
: OpenGLUI() | |||
: OpenGLUI(), | |||
fAboutWindow(this) | |||
{ | |||
Window* win = getParent(); | |||
// background | |||
fImgBackground = Image(DistrhoArtworkStereoEnhancer::backgroundData, DistrhoArtworkStereoEnhancer::backgroundWidth, DistrhoArtworkStereoEnhancer::backgroundHeight, GL_BGR); | |||
// TODO - about png | |||
Image imageAbout(DistrhoArtworkStereoEnhancer::aboutButtonHoverData, DistrhoArtworkStereoEnhancer::aboutButtonHoverWidth, DistrhoArtworkStereoEnhancer::aboutButtonHoverHeight, GL_BGRA); | |||
fAboutWindow.setImage(imageAbout); | |||
// knobs | |||
Image knobImage(DistrhoArtworkStereoEnhancer::knobData, DistrhoArtworkStereoEnhancer::knobWidth, DistrhoArtworkStereoEnhancer::knobHeight); | |||
fKnobWidthLows = new ImageKnob(win, knobImage); | |||
fKnobWidthLows = new ImageKnob(this, knobImage); | |||
fKnobWidthLows->setPos(140, 35); | |||
fKnobWidthLows->setRange(0.0f, 200.0f); | |||
fKnobWidthLows->setValue(100.0f); | |||
fKnobWidthLows->setCallback(this); | |||
fKnobWidthHighs = new ImageKnob(win, knobImage); | |||
fKnobWidthHighs = new ImageKnob(this, knobImage); | |||
fKnobWidthHighs->setPos(362, 35); | |||
fKnobWidthHighs->setRange(0.0f, 200.0f); | |||
fKnobWidthHighs->setValue(100.0f); | |||
fKnobWidthHighs->setCallback(this); | |||
fKnobCrossover = new ImageKnob(win, knobImage); | |||
fKnobCrossover = new ImageKnob(this, knobImage); | |||
fKnobCrossover->setPos(253, 35); | |||
fKnobCrossover->setRange(0.0f, 100.0f); | |||
fKnobCrossover->setValue(27.51604f); | |||
@@ -54,7 +57,7 @@ DistrhoUIStereoEnhancer::DistrhoUIStereoEnhancer() | |||
// about button | |||
Image aboutImageNormal(DistrhoArtworkStereoEnhancer::aboutButtonNormalData, DistrhoArtworkStereoEnhancer::aboutButtonNormalWidth, DistrhoArtworkStereoEnhancer::aboutButtonNormalHeight); | |||
Image aboutImageHover(DistrhoArtworkStereoEnhancer::aboutButtonHoverData, DistrhoArtworkStereoEnhancer::aboutButtonHoverWidth, DistrhoArtworkStereoEnhancer::aboutButtonHoverHeight); | |||
fButtonAbout = new ImageButton(win, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout = new ImageButton(this, aboutImageNormal, aboutImageHover, aboutImageHover); | |||
fButtonAbout->setPos(346, 3); | |||
fButtonAbout->setCallback(this); | |||
} | |||
@@ -105,10 +108,7 @@ void DistrhoUIStereoEnhancer::imageButtonClicked(ImageButton* button, int) | |||
if (button != fButtonAbout) | |||
return; | |||
// TODO | |||
//Image imageAbout(DistrhoArtworkStereoEnhancer::aboutData, DistrhoArtworkStereoEnhancer::aboutWidth, DistrhoArtworkStereoEnhancer::aboutHeight, GL_BGR); | |||
//ImageAboutWindow aboutWindow(getApp(), getParent(), imageAbout); | |||
//aboutWindow.exec(); | |||
fAboutWindow.exec(); | |||
} | |||
void DistrhoUIStereoEnhancer::imageKnobDragStarted(ImageKnob* knob) | |||
@@ -18,6 +18,8 @@ | |||
#define __DISTRHO_UI_3BANDEQ_HPP__ | |||
#include "DistrhoUIOpenGL.hpp" | |||
#include "dgl/ImageAboutWindow.hpp" | |||
#include "dgl/ImageButton.hpp" | |||
#include "dgl/ImageKnob.hpp" | |||
@@ -34,18 +36,18 @@ class DistrhoUIStereoEnhancer : public OpenGLUI, | |||
{ | |||
public: | |||
DistrhoUIStereoEnhancer(); | |||
~DistrhoUIStereoEnhancer(); | |||
~DistrhoUIStereoEnhancer() override; | |||
protected: | |||
// --------------------------------------------- | |||
// Information | |||
unsigned int d_width() const | |||
unsigned int d_width() const override | |||
{ | |||
return DistrhoArtworkStereoEnhancer::backgroundWidth; | |||
} | |||
unsigned int d_height() const | |||
unsigned int d_height() const override | |||
{ | |||
return DistrhoArtworkStereoEnhancer::backgroundHeight; | |||
} | |||
@@ -53,21 +55,22 @@ protected: | |||
// --------------------------------------------- | |||
// DSP Callbacks | |||
void d_parameterChanged(uint32_t index, float value); | |||
void d_programChanged(uint32_t index); | |||
void d_parameterChanged(uint32_t index, float value) override; | |||
void d_programChanged(uint32_t index) override; | |||
// --------------------------------------------- | |||
// Widget Callbacks | |||
void imageButtonClicked(ImageButton* button, int); | |||
void imageKnobDragStarted(ImageKnob* knob); | |||
void imageKnobDragFinished(ImageKnob* knob); | |||
void imageKnobValueChanged(ImageKnob* knob, float value); | |||
void imageButtonClicked(ImageButton* button, int) override; | |||
void imageKnobDragStarted(ImageKnob* knob) override; | |||
void imageKnobDragFinished(ImageKnob* knob) override; | |||
void imageKnobValueChanged(ImageKnob* knob, float value) override; | |||
void onDisplay(); | |||
void onDisplay() override; | |||
private: | |||
Image fImgBackground; | |||
ImageAboutWindow fAboutWindow; | |||
ImageKnob* fKnobWidthLows; | |||
ImageKnob* fKnobWidthHighs; | |||
@@ -48,9 +48,9 @@ protected: | |||
// --------------------------------------------- | |||
// Information | |||
virtual bool d_resizable() { return false; } | |||
virtual uint d_minimumWidth() { return 100; } | |||
virtual uint d_minimumHeight() { return 100; } | |||
virtual bool d_resizable() const { return false; } | |||
virtual uint d_minimumWidth() const { return 100; } | |||
virtual uint d_minimumHeight() const { return 100; } | |||
// --------------------------------------------- | |||
// DSP Callbacks | |||
@@ -41,9 +41,9 @@ public: | |||
void setImage(const Image& image); | |||
protected: | |||
void onDisplay(); | |||
bool onMouse(int button, bool press, int x, int y); | |||
bool onKeyboard(bool press, uint32_t key); | |||
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; | |||
@@ -35,15 +35,17 @@ public: | |||
}; | |||
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(); | |||
bool onMouse(int button, bool press, int x, int y); | |||
bool onMotion(int x, int y); | |||
void onDisplay() override; | |||
bool onMouse(int button, bool press, int x, int y) override; | |||
bool onMotion(int x, int y) override; | |||
private: | |||
Image fImageNormal; | |||
@@ -42,6 +42,7 @@ public: | |||
}; | |||
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; | |||
@@ -53,9 +54,9 @@ public: | |||
void setCallback(Callback* callback); | |||
protected: | |||
void onDisplay(); | |||
bool onMouse(int button, bool press, int x, int y); | |||
bool onMotion(int x, int y); | |||
void onDisplay() override; | |||
bool onMouse(int button, bool press, int x, int y) override; | |||
bool onMotion(int x, int y) override; | |||
private: | |||
Image fImage; | |||
@@ -37,6 +37,7 @@ public: | |||
}; | |||
ImageSlider(Window* parent, const Image& image); | |||
ImageSlider(Widget* widget, const Image& image); | |||
ImageSlider(const ImageSlider& imageSlider); | |||
float getValue() const; | |||
@@ -52,9 +53,9 @@ public: | |||
void setCallback(Callback* callback); | |||
protected: | |||
void onDisplay(); | |||
bool onMouse(int button, bool press, int x, int y); | |||
bool onMotion(int x, int y); | |||
void onDisplay() override; | |||
bool onMouse(int button, bool press, int x, int y) override; | |||
bool onMotion(int x, int y) override; | |||
private: | |||
Image fImage; | |||
@@ -22,10 +22,6 @@ OBJS = \ | |||
src/Widget.cpp.o \ | |||
src/Window.cpp.o | |||
ifeq ($(MACOS),true) | |||
OBJS += src/pugl/pugl_osx.m.o | |||
endif | |||
OBJS_posix32 = \ | |||
src/App.cpp.posix32.o \ | |||
src/Image.cpp.posix32.o \ | |||
@@ -70,6 +66,12 @@ OBJS_win64 = \ | |||
src/Widget.cpp.win64.o \ | |||
src/Window.cpp.win64.o | |||
ifeq ($(MACOS),true) | |||
OBJS += src/pugl/pugl_osx_extended.m.o | |||
OBJS_posix32 += src/pugl/pugl_osx_extended.m.posix32.o | |||
OBJS_posix64 += src/pugl/pugl_osx_extended.m.posix64.o | |||
endif | |||
# -------------------------------------------------------------- | |||
all: ../../dgl.a | |||
@@ -100,10 +102,10 @@ win64: ../../dgl.win64.a | |||
$(CXX) $^ -shared $(LINK_FLAGS) -lopengl32 -lgdi32 -o $@ | |||
../../dgl.dylib: $(OBJS) | |||
$(CXX) $^ -shared $(LINK_FLAGS) -framework Cocoa -framework OpenGL -o $@ | |||
$(CXX) $^ -shared $(LINK_FLAGS) -framework OpenGL -framework Cocoa -o $@ | |||
../../dgl.so: $(OBJS) | |||
$(CXX) $^ -shared $(LINK_FLAGS) -lX11 -lGL -lGLU -o $@ | |||
$(CXX) $^ -shared $(LINK_FLAGS) -lGL -lX11 -o $@ | |||
# -------------------------------------------------------------- | |||
@@ -33,6 +33,17 @@ ImageButton::ImageButton(Window* parent, const Image& image) | |||
{ | |||
} | |||
ImageButton::ImageButton(Widget* widget, const Image& image) | |||
: Widget(widget->getParent()), | |||
fImageNormal(image), | |||
fImageHover(image), | |||
fImageDown(image), | |||
fCurImage(&fImageNormal), | |||
fCurButton(-1), | |||
fCallback(nullptr) | |||
{ | |||
} | |||
ImageButton::ImageButton(Window* parent, const Image& imageNormal, const Image& imageHover, const Image& imageDown) | |||
: Widget(parent), | |||
fImageNormal(imageNormal), | |||
@@ -47,6 +58,20 @@ ImageButton::ImageButton(Window* parent, const Image& imageNormal, const Image& | |||
setSize(fCurImage->getSize()); | |||
} | |||
ImageButton::ImageButton(Widget* widget, const Image& imageNormal, const Image& imageHover, const Image& imageDown) | |||
: Widget(widget->getParent()), | |||
fImageNormal(imageNormal), | |||
fImageHover(imageHover), | |||
fImageDown(imageDown), | |||
fCurImage(&fImageNormal), | |||
fCurButton(-1), | |||
fCallback(nullptr) | |||
{ | |||
assert(fImageNormal.getSize() == fImageHover.getSize() && fImageHover.getSize() == fImageDown.getSize()); | |||
setSize(fCurImage->getSize()); | |||
} | |||
ImageButton::ImageButton(const ImageButton& imageButton) | |||
: Widget(imageButton.getParent()), | |||
fImageNormal(imageButton.fImageNormal), | |||
@@ -39,6 +39,25 @@ ImageKnob::ImageKnob(Window* parent, const Image& image, Orientation orientation | |||
setSize(fImgLayerSize, fImgLayerSize); | |||
} | |||
ImageKnob::ImageKnob(Widget* widget, const Image& image, Orientation orientation) | |||
: Widget(widget->getParent()), | |||
fImage(image), | |||
fMinimum(0.0f), | |||
fMaximum(1.0f), | |||
fValue(0.5f), | |||
fOrientation(orientation), | |||
fDragging(false), | |||
fLastX(0), | |||
fLastY(0), | |||
fCallback(nullptr), | |||
fIsImgVertical(image.getHeight() > image.getWidth()), | |||
fImgLayerSize(fIsImgVertical ? image.getWidth() : image.getHeight()), | |||
fImgLayerCount(fIsImgVertical ? image.getHeight()/fImgLayerSize : image.getWidth()/fImgLayerSize), | |||
fKnobArea(0, 0, fImgLayerSize, fImgLayerSize) | |||
{ | |||
setSize(fImgLayerSize, fImgLayerSize); | |||
} | |||
ImageKnob::ImageKnob(const ImageKnob& imageKnob) | |||
: Widget(imageKnob.getParent()), | |||
fImage(imageKnob.fImage), | |||
@@ -34,6 +34,20 @@ ImageSlider::ImageSlider(Window* parent, const Image& image) | |||
setSize(fImage.getSize()); | |||
} | |||
ImageSlider::ImageSlider(Widget* widget, const Image& image) | |||
: Widget(widget->getParent()), | |||
fImage(image), | |||
fMinimum(0.0f), | |||
fMaximum(1.0f), | |||
fValue(0.5f), | |||
fDragging(false), | |||
fStartedX(0), | |||
fStartedY(0), | |||
fCallback(nullptr) | |||
{ | |||
setSize(fImage.getSize()); | |||
} | |||
ImageSlider::ImageSlider(const ImageSlider& imageSlider) | |||
: Widget(imageSlider.getParent()), | |||
fImage(imageSlider.fImage), | |||
@@ -24,7 +24,9 @@ | |||
#if DGL_OS_WINDOWS | |||
# include "pugl/pugl_win.cpp" | |||
#elif DGL_OS_MAC | |||
// compiled separately | |||
extern "C" { | |||
# include "pugl/pugl_osx_extended.h" | |||
} | |||
#elif DGL_OS_LINUX | |||
extern "C" { | |||
# include "pugl/pugl_x11.c" | |||
@@ -191,6 +193,8 @@ public: | |||
SetForegroundWindow(hwnd); | |||
SetActiveWindow(hwnd); | |||
SetFocus(hwnd); | |||
#elif DGL_OS_MAC | |||
puglImplFocus(kView); | |||
#elif DGL_OS_LINUX | |||
XRaiseWindow(xDisplay, xWindow); | |||
XSetInputFocus(xDisplay, xWindow, RevertToPointerRoot, CurrentTime); | |||
@@ -261,6 +265,8 @@ public: | |||
} | |||
UpdateWindow(hwnd); | |||
#elif DGL_OS_MAC | |||
puglImplSetVisible(kView, yesNo); | |||
#elif DGL_OS_LINUX | |||
if (yesNo) | |||
XMapRaised(xDisplay, xWindow); | |||
@@ -297,6 +303,8 @@ 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 DGL_OS_MAC | |||
puglImplSetSize(kView, width, height); | |||
#elif DGL_OS_LINUX | |||
// TODO - handle fResizable | |||
XSizeHints sizeHints; | |||
@@ -318,6 +326,8 @@ public: | |||
{ | |||
#if DGL_OS_WINDOWS | |||
SetWindowTextA(hwnd, title); | |||
#elif DGL_OS_MAC | |||
puglImplSetTitle(kView, title); | |||
#elif DGL_OS_LINUX | |||
XStoreName(xDisplay, xWindow, title); | |||
XFlush(xDisplay); | |||
@@ -0,0 +1,29 @@ | |||
/* | |||
Copyright 2012 David Robillard <http://drobilla.net> | |||
Copyright 2013 Fil... | |||
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. | |||
THIS 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. | |||
*/ | |||
/** | |||
@file pugl_osx_extended.h Extended OSX/Cocoa Pugl Implementation. | |||
*/ | |||
#include <stdbool.h> | |||
#include "pugl.h" | |||
void puglImplFocus(PuglView* view); | |||
void puglImplSetSize(PuglView* view, unsigned int width, unsigned int height); | |||
void puglImplSetTitle(PuglView* view, const char* title); | |||
void puglImplSetVisible(PuglView* view, bool yesNo); |
@@ -0,0 +1,65 @@ | |||
/* | |||
Copyright 2012 David Robillard <http://drobilla.net> | |||
Copyright 2013 Fil... | |||
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. | |||
THIS 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. | |||
*/ | |||
/** | |||
@file pugl_osx_extended.m Extended OSX/Cocoa Pugl Implementation. | |||
*/ | |||
#import "pugl_osx.m" | |||
#include "pugl_osx_extended.h" | |||
void puglImplFocus(PuglView* view) | |||
{ | |||
// TODO | |||
} | |||
void puglImplSetSize(PuglView* view, unsigned int width, unsigned int height) | |||
{ | |||
id window = view->impl->window; | |||
// TODO | |||
// NSRect frame = [window frame]; | |||
// frame.size.width = width; | |||
// frame.size.height = height; | |||
// display:NO ? | |||
// [window setFrame:frame display:YES animate:NO]; | |||
} | |||
void puglImplSetTitle(PuglView* view, const char* title) | |||
{ | |||
id window = view->impl->window; | |||
NSString* titleString = [[NSString alloc] | |||
initWithBytes:title | |||
length:strlen(title) | |||
encoding:NSUTF8StringEncoding]; | |||
[window setTitle:titleString]; | |||
} | |||
void puglImplSetVisible(PuglView* view, bool yesNo) | |||
{ | |||
id window = view->impl->window; | |||
if (yesNo) { | |||
[window setIsVisible:YES]; | |||
} else { | |||
[window setIsVisible:NO]; | |||
} | |||
} |