Browse Source

Update DPF

Signed-off-by: falkTX <falktx@falktx.com>
master
falkTX 3 years ago
parent
commit
c4d4c60012
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
3 changed files with 44 additions and 21 deletions
  1. +6
    -6
      .github/workflows/build.yml
  2. +1
    -1
      dpf
  3. +37
    -14
      plugins/glBars/ResizeHandle.hpp

+ 6
- 6
.github/workflows/build.yml View File

@@ -22,7 +22,7 @@ jobs:
run: | run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal libpcre2-16-0/focal libpcre2-32-0/focal libpcre2-posix2/focal
- name: Set up dependencies - name: Set up dependencies
run: | run: |
sudo dpkg --add-architecture arm64 sudo dpkg --add-architecture arm64
@@ -60,7 +60,7 @@ jobs:
run: | run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal libpcre2-16-0/focal libpcre2-32-0/focal libpcre2-posix2/focal
- name: Set up dependencies - name: Set up dependencies
run: | run: |
sudo dpkg --add-architecture armhf sudo dpkg --add-architecture armhf
@@ -98,7 +98,7 @@ jobs:
run: | run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal libpcre2-16-0/focal libpcre2-32-0/focal libpcre2-posix2/focal
- name: Set up dependencies - name: Set up dependencies
run: | run: |
sudo dpkg --add-architecture i386 sudo dpkg --add-architecture i386
@@ -193,7 +193,7 @@ jobs:
run: | run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
sudo apt-get update -qq sudo apt-get update -qq
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal
sudo apt-get install -yqq --allow-downgrades libpcre2-8-0/focal libpcre2-16-0/focal libpcre2-32-0/focal libpcre2-posix2/focal
- name: Set up dependencies - name: Set up dependencies
run: | run: |
sudo dpkg --add-architecture i386 sudo dpkg --add-architecture i386
@@ -327,14 +327,14 @@ jobs:
done done
- name: Test VST2 plugins - name: Test VST2 plugins
run: | run: |
for p in $(ls bin/ | grep vst.so); do \
for p in $(find bin/ | grep -e vst.so -e '.*\.vst/.*\.so'); do \
env CARLA_BRIDGE_DUMMY=1 CARLA_BRIDGE_TESTING=native \ env CARLA_BRIDGE_DUMMY=1 CARLA_BRIDGE_TESTING=native \
valgrind \ valgrind \
--error-exitcode=255 \ --error-exitcode=255 \
--leak-check=full \ --leak-check=full \
--track-origins=yes \ --track-origins=yes \
--suppressions=./dpf/utils/valgrind-dpf.supp \ --suppressions=./dpf/utils/valgrind-dpf.supp \
/usr/lib/carla/carla-bridge-native vst2 ./bin/${p} "" 1>/dev/null; \
/usr/lib/carla/carla-bridge-native vst2 ./${p} "" 1>/dev/null; \
done done
- name: Test VST3 plugins - name: Test VST3 plugins
run: | run: |


+ 1
- 1
dpf

@@ -1 +1 @@
Subproject commit 7f206b99dcccadbf26376ea6db0b9557800dd97d
Subproject commit 5d7fd17f6a634ccd648a264743319c145928a27c

+ 37
- 14
plugins/glBars/ResizeHandle.hpp View File

@@ -1,6 +1,6 @@
/* /*
* Resize handle for DPF * Resize handle for DPF
* Copyright (C) 2021 Filipe Coelho <falktx@falktx.com>
* Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
* *
* Permission to use, copy, modify, and/or distribute this software for any purpose with * 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 * or without fee is hereby granted, provided that the above copyright notice and this
@@ -29,7 +29,8 @@ public:
explicit ResizeHandle(Window& window) explicit ResizeHandle(Window& window)
: TopLevelWidget(window), : TopLevelWidget(window),
handleSize(16), handleSize(16),
resizing(false)
hasCursor(false),
isResizing(false)
{ {
resetArea(); resetArea();
} }
@@ -38,12 +39,14 @@ public:
explicit ResizeHandle(TopLevelWidget* const tlw) explicit ResizeHandle(TopLevelWidget* const tlw)
: TopLevelWidget(tlw->getWindow()), : TopLevelWidget(tlw->getWindow()),
handleSize(16), handleSize(16),
resizing(false)
hasCursor(false),
isResizing(false)
{ {
resetArea(); resetArea();
} }


/** Set the handle size, minimum 16. */
/** Set the handle size, minimum 16.
* Scale factor is automatically applied on top of this size as needed */
void setHandleSize(const uint size) void setHandleSize(const uint size)
{ {
handleSize = std::max(16u, size); handleSize = std::max(16u, size);
@@ -53,12 +56,14 @@ public:
protected: protected:
void onDisplay() override void onDisplay() override
{ {
// TODO implement gl3 stuff in DPF
#ifndef DGL_USE_OPENGL3
const GraphicsContext& context(getGraphicsContext()); const GraphicsContext& context(getGraphicsContext());
const double lineWidth = 1.0 * getScaleFactor(); const double lineWidth = 1.0 * getScaleFactor();


#ifdef DGL_OPENGL
#if defined(DGL_OPENGL) && !defined(DGL_USE_OPENGL3)
glMatrixMode(GL_MODELVIEW); glMatrixMode(GL_MODELVIEW);
#endif
#endif


// draw white lines, 1px wide // draw white lines, 1px wide
Color(1.0f, 1.0f, 1.0f).setFor(context); Color(1.0f, 1.0f, 1.0f).setFor(context);
@@ -75,6 +80,7 @@ protected:
l1b.draw(context, lineWidth); l1b.draw(context, lineWidth);
l2b.draw(context, lineWidth); l2b.draw(context, lineWidth);
l3b.draw(context, lineWidth); l3b.draw(context, lineWidth);
#endif
} }


bool onMouse(const MouseEvent& ev) override bool onMouse(const MouseEvent& ev) override
@@ -84,15 +90,16 @@ protected:


if (ev.press && area.contains(ev.pos)) if (ev.press && area.contains(ev.pos))
{ {
resizing = true;
isResizing = true;
resizingSize = Size<double>(getWidth(), getHeight()); resizingSize = Size<double>(getWidth(), getHeight());
lastResizePoint = ev.pos; lastResizePoint = ev.pos;
return true; return true;
} }


if (resizing && ! ev.press)
if (isResizing && ! ev.press)
{ {
resizing = false;
isResizing = false;
recheckCursor(ev.pos);
return true; return true;
} }


@@ -101,8 +108,11 @@ protected:


bool onMotion(const MotionEvent& ev) override bool onMotion(const MotionEvent& ev) override
{ {
if (! resizing)
if (! isResizing)
{
recheckCursor(ev.pos);
return false; return false;
}


const Size<double> offset(ev.pos.getX() - lastResizePoint.getX(), const Size<double> offset(ev.pos.getX() - lastResizePoint.getX(),
ev.pos.getY() - lastResizePoint.getY()); ev.pos.getY() - lastResizePoint.getY());
@@ -110,9 +120,11 @@ protected:
resizingSize += offset; resizingSize += offset;
lastResizePoint = ev.pos; lastResizePoint = ev.pos;


// TODO min width, min height
const uint minWidth = 16;
const uint minHeight = 16;
// TODO keepAspectRatio
bool keepAspectRatio;
const Size<uint> minSize(getWindow().getGeometryConstraints(keepAspectRatio));
const uint minWidth = minSize.getWidth();
const uint minHeight = minSize.getHeight();


if (resizingSize.getWidth() < minWidth) if (resizingSize.getWidth() < minWidth)
resizingSize.setWidth(minWidth); resizingSize.setWidth(minWidth);
@@ -139,10 +151,21 @@ private:
uint handleSize; uint handleSize;


// event handling state // event handling state
bool resizing;
bool hasCursor, isResizing;
Point<double> lastResizePoint; Point<double> lastResizePoint;
Size<double> resizingSize; Size<double> resizingSize;


void recheckCursor(const Point<double>& pos)
{
const bool shouldHaveCursor = area.contains(pos);

if (shouldHaveCursor == hasCursor)
return;

hasCursor = shouldHaveCursor;
setCursor(shouldHaveCursor ? kMouseCursorDiagonal : kMouseCursorArrow);
}

void resetArea() void resetArea()
{ {
const double scaleFactor = getScaleFactor(); const double scaleFactor = getScaleFactor();


Loading…
Cancel
Save