Browse Source

Build CairoUI by default now that DPF cairo APIs are going stable

pull/272/head
falkTX 3 years ago
parent
commit
6f21873277
9 changed files with 47 additions and 41 deletions
  1. +3
    -5
      Makefile
  2. +3
    -0
      distrho/DistrhoUI.hpp
  3. +4
    -4
      examples/CairoUI/CairoExampleUI.cpp
  4. +8
    -10
      examples/CairoUI/DemoWidgetBanner.cpp
  5. +9
    -5
      examples/CairoUI/DemoWidgetBanner.hpp
  6. +8
    -10
      examples/CairoUI/DemoWidgetClickable.cpp
  7. +9
    -5
      examples/CairoUI/DemoWidgetClickable.hpp
  8. +3
    -1
      examples/CairoUI/DistrhoPluginInfo.h
  9. +0
    -1
      examples/Parameters/Makefile

+ 3
- 5
Makefile View File

@@ -26,11 +26,9 @@ examples: dgl
$(MAKE) all -C examples/MidiThrough
$(MAKE) all -C examples/Parameters
$(MAKE) all -C examples/States

# ifeq ($(HAVE_CAIRO),true)
# $(MAKE) all -C examples/CairoUI
# endif

ifeq ($(HAVE_CAIRO),true)
$(MAKE) all -C examples/CairoUI
endif
ifneq ($(MACOS_OR_WINDOWS),true)
# ExternalUI is WIP
$(MAKE) all -C examples/ExternalUI


+ 3
- 0
distrho/DistrhoUI.hpp View File

@@ -27,6 +27,9 @@ typedef DISTRHO_NAMESPACE::ExternalWindow UIWidget;
#elif DISTRHO_UI_USE_CUSTOM
# include DISTRHO_UI_CUSTOM_INCLUDE_PATH
typedef DISTRHO_UI_CUSTOM_WIDGET_TYPE UIWidget;
#elif DISTRHO_UI_USE_CAIRO
# include "../dgl/Cairo.hpp"
typedef DGL_NAMESPACE::CairoTopLevelWidget UIWidget;
#elif DISTRHO_UI_USE_NANOVG
# include "../dgl/NanoVG.hpp"
typedef DGL_NAMESPACE::NanoTopLevelWidget UIWidget;


+ 4
- 4
examples/CairoUI/CairoExampleUI.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 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
@@ -17,7 +17,6 @@
#include "DistrhoUI.hpp"
#include "DemoWidgetBanner.hpp"
#include "DemoWidgetClickable.hpp"
#include "Window.hpp"

START_NAMESPACE_DISTRHO

@@ -42,9 +41,10 @@ public:
{
}

void onDisplay()
protected:
void onCairoDisplay(const CairoGraphicsContext& context)
{
cairo_t* cr = getParentWindow().getGraphicsContext().cairo;
cairo_t* cr = context.handle;

cairo_set_source_rgb(cr, 1.0, 0.8, 0.5);
cairo_paint(cr);


+ 8
- 10
examples/CairoUI/DemoWidgetBanner.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 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
@@ -16,9 +16,6 @@

#include "DemoWidgetBanner.hpp"

#include "Cairo.hpp"
#include "Window.hpp"

START_NAMESPACE_DGL

// -----------------------------------------------------------------------
@@ -54,14 +51,15 @@ enum
columns = 72,
};

DemoWidgetBanner::DemoWidgetBanner(Widget* group)
: Widget(group)
{
}
DemoWidgetBanner::DemoWidgetBanner(SubWidget* parent)
: CairoSubWidget(parent) {}

DemoWidgetBanner::DemoWidgetBanner(TopLevelWidget* parent)
: CairoSubWidget(parent) {}

void DemoWidgetBanner::onDisplay()
void DemoWidgetBanner::onCairoDisplay(const CairoGraphicsContext& context)
{
cairo_t* cr = getParentWindow().getGraphicsContext().cairo;
cairo_t* cr = context.handle;

Size<uint> sz = getSize();
int w = sz.getWidth();


+ 9
- 5
examples/CairoUI/DemoWidgetBanner.hpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 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
@@ -14,17 +14,21 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include "Widget.hpp"
#pragma once

#include "Cairo.hpp"

START_NAMESPACE_DGL

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

class DemoWidgetBanner : public Widget
class DemoWidgetBanner : public CairoSubWidget
{
public:
explicit DemoWidgetBanner(Widget* group);
void onDisplay() override;
explicit DemoWidgetBanner(SubWidget* parent);
explicit DemoWidgetBanner(TopLevelWidget* parent);
protected:
void onCairoDisplay(const CairoGraphicsContext& context) override;
};

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


+ 8
- 10
examples/CairoUI/DemoWidgetClickable.cpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 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
@@ -16,21 +16,19 @@

#include "DemoWidgetClickable.hpp"

#include "Cairo.hpp"
#include "Window.hpp"

START_NAMESPACE_DGL

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

DemoWidgetClickable::DemoWidgetClickable(Widget* group)
: Widget(group)
{
}
DemoWidgetClickable::DemoWidgetClickable(SubWidget* parent)
: CairoSubWidget(parent) {}

DemoWidgetClickable::DemoWidgetClickable(TopLevelWidget* parent)
: CairoSubWidget(parent) {}

void DemoWidgetClickable::onDisplay()
void DemoWidgetClickable::onCairoDisplay(const CairoGraphicsContext& context)
{
cairo_t* cr = getParentWindow().getGraphicsContext().cairo;
cairo_t* cr = context.handle;

Size<uint> sz = getSize();
int w = sz.getWidth();


+ 9
- 5
examples/CairoUI/DemoWidgetClickable.hpp View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 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
@@ -14,17 +14,21 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include "Widget.hpp"
#pragma once

#include "Cairo.hpp"

START_NAMESPACE_DGL

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

class DemoWidgetClickable : public Widget
class DemoWidgetClickable : public CairoSubWidget
{
public:
explicit DemoWidgetClickable(Widget* group);
void onDisplay() override;
explicit DemoWidgetClickable(SubWidget* group);
explicit DemoWidgetClickable(TopLevelWidget* parent);
protected:
void onCairoDisplay(const CairoGraphicsContext& context) override;
bool onMouse(const MouseEvent& event) override;

private:


+ 3
- 1
examples/CairoUI/DistrhoPluginInfo.h View File

@@ -1,6 +1,6 @@
/*
* DISTRHO Plugin Framework (DPF)
* Copyright (C) 2012-2019 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2012-2021 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
@@ -116,3 +116,5 @@
By default this is set to @ref DISTRHO_PLUGIN_URI with "#UI" as suffix.
*/
#define DISTRHO_UI_URI DISTRHO_PLUGIN_URI "#UI"

#define DISTRHO_UI_USE_CAIRO 1

+ 0
- 1
examples/Parameters/Makefile View File

@@ -21,7 +21,6 @@ FILES_UI = \
# --------------------------------------------------------------
# Do some magic

UI_TYPE = cairo
include ../../Makefile.plugins.mk

# --------------------------------------------------------------


Loading…
Cancel
Save