Best way to draw links between components


Hi there !

I am implementing an open source “patcher” and have made it to the point where I need to draw the connections between outlets and inlets.

What is the best way to draw these connections, knowing that:

  1. A user might clic on a line to remove a connection or ‘press’ it to get current signal flow in the connection
  2. Objects can be moved around (so inlets and outlets move)

My two ideas are:

A. draw the connections in the main component (workplace) and handle mouse operations there
B. implement a “Link” Component

What is the best way to do this ?



Have a look at how the juce AudioGraph Editor is done. both objects and connections are Components with a custom hitTest()


I feel silly… where do you find this editor ?


Anyone knows where the “AudioGraph Editor” can be found ?


juce/extras/audio plugin host


Thanks for the pointer.

I had to use screen coordinates because links can go from any nested component to another. Not sure how this will behave with multiple screens…

I think I will use coordinates in Workspace instead (seems safer).


Just a quickie to say that I managed to draw the links between nodes and that the pointer to the sources from “audio plugin host” was a great advice.

Here is a snapshot of Mimas during a link drag operation.

[attachment=0]link creation in mimas.png[/attachment]