Best way to draw links between components


#1

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 ?

Gaspard


#2

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


#3

I feel silly… where do you find this editor ?


#4

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


#5

juce/extras/audio plugin host


#6

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).


#7

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]

Cheers,

Gaspard