Browse Source

Update DPF

Signed-off-by: falkTX <falktx@falktx.com>
master
falkTX 9 months 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: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
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
run: |
sudo dpkg --add-architecture arm64
@@ -60,7 +60,7 @@ jobs:
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
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
run: |
sudo dpkg --add-architecture armhf
@@ -98,7 +98,7 @@ jobs:
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
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
run: |
sudo dpkg --add-architecture i386
@@ -193,7 +193,7 @@ jobs:
run: |
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
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
run: |
sudo dpkg --add-architecture i386
@@ -327,14 +327,14 @@ jobs:
done
- name: Test VST2 plugins
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 \
valgrind \
--error-exitcode=255 \
--leak-check=full \
--track-origins=yes \
--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
- name: Test VST3 plugins
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
* 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
* or without fee is hereby granted, provided that the above copyright notice and this
@@ -29,7 +29,8 @@ public:
explicit ResizeHandle(Window& window)
: TopLevelWidget(window),
handleSize(16),
resizing(false)
hasCursor(false),
isResizing(false)
{
resetArea();
}
@@ -38,12 +39,14 @@ public:
explicit ResizeHandle(TopLevelWidget* const tlw)
: TopLevelWidget(tlw->getWindow()),
handleSize(16),
resizing(false)
hasCursor(false),
isResizing(false)
{
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)
{
handleSize = std::max(16u, size);
@@ -53,12 +56,14 @@ public:
protected:
void onDisplay() override
{
// TODO implement gl3 stuff in DPF
#ifndef DGL_USE_OPENGL3
const GraphicsContext& context(getGraphicsContext());
const double lineWidth = 1.0 * getScaleFactor();

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

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

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

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

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

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

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

const Size<double> offset(ev.pos.getX() - lastResizePoint.getX(),
ev.pos.getY() - lastResizePoint.getY());
@@ -110,9 +120,11 @@ protected:
resizingSize += offset;
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)
resizingSize.setWidth(minWidth);
@@ -139,10 +151,21 @@ private:
uint handleSize;

// event handling state
bool resizing;
bool hasCursor, isResizing;
Point<double> lastResizePoint;
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()
{
const double scaleFactor = getScaleFactor();


Loading…
Cancel
Save