Browse Source

Change poly cable thickness. Change double-click behavior. Fix input default number of channels.

tags/v1.0.0
Andrew Belt 5 years ago
parent
commit
e625a1cd27
6 changed files with 18 additions and 11 deletions
  1. +1
    -1
      LICENSE.md
  2. +9
    -3
      include/engine/Port.hpp
  3. +1
    -1
      include/event.hpp
  4. +1
    -1
      src/app/CableWidget.cpp
  5. +5
    -4
      src/event.cpp
  6. +1
    -1
      src/window.cpp

+ 1
- 1
LICENSE.md View File

@@ -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. 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/). 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. The **VCV logo and icon** are copyright © 2017 Andrew Belt and may not be used in derivative works.




+ 9
- 3
include/engine/Port.hpp View File

@@ -22,9 +22,9 @@ struct Port {
Unstable API. Use set/getChannels() instead. Unstable API. Use set/getChannels() instead.
May be 0 to PORT_MAX_CHANNELS. May be 0 to PORT_MAX_CHANNELS.
*/ */
uint8_t channels = 1;
uint8_t channels = 0;
/** Unstable API. Use isConnected() instead. */ /** Unstable API. Use isConnected() instead. */
bool active;
bool active = false;
/** For rendering plug lights on cables. /** For rendering plug lights on cables.
Green for positive, red for negative, and blue for polyphonic. 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 {}; struct Input : Port {};






+ 1
- 1
include/event.hpp View File

@@ -254,7 +254,7 @@ struct State {
widget::Widget *scrollWidget = NULL; widget::Widget *scrollWidget = NULL;
/** For double-clicking */ /** For double-clicking */
double lastClickTime = -INFINITY; double lastClickTime = -INFINITY;
math::Vec lastClickPos;
widget::Widget *lastClickedWidget = NULL;


void setHovered(widget::Widget *w); void setHovered(widget::Widget *w);
void setDragged(widget::Widget *w); void setDragged(widget::Widget *w);


+ 1
- 1
src/app/CableWidget.cpp View File

@@ -216,7 +216,7 @@ void CableWidget::draw(const widget::DrawContext &ctx) {
// Draw opaque if mouse is hovering over a connected port // Draw opaque if mouse is hovering over a connected port
if (output->channels > 1) { if (output->channels > 1) {
// Increase thickness if output port is polyphonic // Increase thickness if output port is polyphonic
thickness = 7;
thickness = 9;
} }


if (outputPort->hovered || inputPort->hovered) { if (outputPort->hovered || inputPort->hovered) {


+ 5
- 4
src/event.cpp View File

@@ -98,6 +98,7 @@ void State::finalizeWidget(widget::Widget *w) {
if (dragHoveredWidget == w) setDragHovered(NULL); if (dragHoveredWidget == w) setDragHovered(NULL);
if (selectedWidget == w) setSelected(NULL); if (selectedWidget == w) setSelected(NULL);
if (scrollWidget == w) scrollWidget = NULL; if (scrollWidget == w) scrollWidget = NULL;
if (lastClickedWidget == w) lastClickedWidget = NULL;
} }


void State::handleButton(math::Vec pos, int button, int action, int mods) { 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) { if (action == GLFW_PRESS) {
const double doubleClickDuration = 0.5; const double doubleClickDuration = 0.5;
const float doubleClickDistance = 10;
double clickTime = glfwGetTime(); double clickTime = glfwGetTime();
if (clickTime - lastClickTime <= doubleClickDuration && pos.minus(lastClickPos).norm() <= doubleClickDistance) {

if (clickedWidget
&& clickTime - lastClickTime <= doubleClickDuration
&& lastClickedWidget == clickedWidget) {
// event::DoubleClick // event::DoubleClick
event::DoubleClick eDoubleClick; event::DoubleClick eDoubleClick;
clickedWidget->onDoubleClick(eDoubleClick); clickedWidget->onDoubleClick(eDoubleClick);
} }
lastClickTime = clickTime; lastClickTime = clickTime;
lastClickPos = pos;
lastClickedWidget = clickedWidget;
} }
} }




+ 1
- 1
src/window.cpp View File

@@ -433,7 +433,7 @@ int Window::getMods() {
} }


void Window::setFullScreen(bool fullScreen) { void Window::setFullScreen(bool fullScreen) {
if (isFullScreen()) {
if (!fullScreen) {
glfwSetWindowMonitor(win, NULL, internal->lastWindowX, internal->lastWindowY, internal->lastWindowWidth, internal->lastWindowHeight, GLFW_DONT_CARE); glfwSetWindowMonitor(win, NULL, internal->lastWindowX, internal->lastWindowY, internal->lastWindowWidth, internal->lastWindowHeight, GLFW_DONT_CARE);
} }
else { else {


Loading…
Cancel
Save