From e625a1cd27d7094dc4e69cbdc52ad0e083897913 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Sun, 3 Feb 2019 22:01:18 -0500 Subject: [PATCH] Change poly cable thickness. Change double-click behavior. Fix input default number of channels. --- LICENSE.md | 2 +- include/engine/Port.hpp | 12 +++++++++--- include/event.hpp | 2 +- src/app/CableWidget.cpp | 2 +- src/event.cpp | 9 +++++---- src/window.cpp | 2 +- 6 files changed, 18 insertions(+), 11 deletions(-) diff --git a/LICENSE.md b/LICENSE.md index 01a4a4fd..4cf8f1ec 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -11,7 +11,7 @@ However, a free commercial license is available for plugins sold through the [VC Email contact@vcvrack.com for more information about licensing or the VCV Store. The **Core panel graphics** in the `res/Core` directory are copyright © 2019 [Grayscale](http://grayscale.info/) and licensed under [CC BY-NC-ND 4.0](https://creativecommons.org/licenses/by-nc-nd/4.0/). -You may not create derivative works. +You may not create derivative works of these graphics. The **VCV logo and icon** are copyright © 2017 Andrew Belt and may not be used in derivative works. diff --git a/include/engine/Port.hpp b/include/engine/Port.hpp index a262dcc4..ece1002d 100644 --- a/include/engine/Port.hpp +++ b/include/engine/Port.hpp @@ -22,9 +22,9 @@ struct Port { Unstable API. Use set/getChannels() instead. May be 0 to PORT_MAX_CHANNELS. */ - uint8_t channels = 1; + uint8_t channels = 0; /** Unstable API. Use isConnected() instead. */ - bool active; + bool active = false; /** For rendering plug lights on cables. Green for positive, red for negative, and blue for polyphonic. */ @@ -84,7 +84,13 @@ struct Port { }; -struct Output : Port {}; +struct Output : Port { + Output() { + channels = 1; + } +}; + + struct Input : Port {}; diff --git a/include/event.hpp b/include/event.hpp index 9e422dfa..c126073e 100644 --- a/include/event.hpp +++ b/include/event.hpp @@ -254,7 +254,7 @@ struct State { widget::Widget *scrollWidget = NULL; /** For double-clicking */ double lastClickTime = -INFINITY; - math::Vec lastClickPos; + widget::Widget *lastClickedWidget = NULL; void setHovered(widget::Widget *w); void setDragged(widget::Widget *w); diff --git a/src/app/CableWidget.cpp b/src/app/CableWidget.cpp index 0ff1d7ef..fa00d815 100644 --- a/src/app/CableWidget.cpp +++ b/src/app/CableWidget.cpp @@ -216,7 +216,7 @@ void CableWidget::draw(const widget::DrawContext &ctx) { // Draw opaque if mouse is hovering over a connected port if (output->channels > 1) { // Increase thickness if output port is polyphonic - thickness = 7; + thickness = 9; } if (outputPort->hovered || inputPort->hovered) { diff --git a/src/event.cpp b/src/event.cpp index 597bdf7e..f7854c18 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -98,6 +98,7 @@ void State::finalizeWidget(widget::Widget *w) { if (dragHoveredWidget == w) setDragHovered(NULL); if (selectedWidget == w) setSelected(NULL); if (scrollWidget == w) scrollWidget = NULL; + if (lastClickedWidget == w) lastClickedWidget = NULL; } void State::handleButton(math::Vec pos, int button, int action, int mods) { @@ -136,16 +137,16 @@ void State::handleButton(math::Vec pos, int button, int action, int mods) { if (action == GLFW_PRESS) { const double doubleClickDuration = 0.5; - const float doubleClickDistance = 10; double clickTime = glfwGetTime(); - if (clickTime - lastClickTime <= doubleClickDuration && pos.minus(lastClickPos).norm() <= doubleClickDistance) { - + if (clickedWidget + && clickTime - lastClickTime <= doubleClickDuration + && lastClickedWidget == clickedWidget) { // event::DoubleClick event::DoubleClick eDoubleClick; clickedWidget->onDoubleClick(eDoubleClick); } lastClickTime = clickTime; - lastClickPos = pos; + lastClickedWidget = clickedWidget; } } diff --git a/src/window.cpp b/src/window.cpp index 908e9f2d..c521c1d0 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -433,7 +433,7 @@ int Window::getMods() { } void Window::setFullScreen(bool fullScreen) { - if (isFullScreen()) { + if (!fullScreen) { glfwSetWindowMonitor(win, NULL, internal->lastWindowX, internal->lastWindowY, internal->lastWindowWidth, internal->lastWindowHeight, GLFW_DONT_CARE); } else {