cplussharp / graph-studio-next

GraphStudioNext is a tool for developers to build and test DirectShow Graphs
355 stars 94 forks source link

Connect newly created filters to currently selected filter #265

Closed GoogleCodeExporter closed 7 years ago

GoogleCodeExporter commented 9 years ago
I'd like to have this feature in the program:

When creating new filter automatically connected it to the selected filter(s) 
if any.
The connection should use the current intelligent/direct/select media type mode.
If the connection attempt fails no error message should be shown (unless select 
media type dialog has been shown). If the user wants to diagnose the connection 
failure they need to retry the connection.

As this is a potentially intrusive and annoying feature for those used to graph 
edit perhaps it should be optional and disabled by default. It may cause weird 
connections in intelligent connect mode - perhaps it shouldn't happen in this 
case.

Logic:

If any pins are selected on filters 
Attempt to connect new filter to selected pin as done currently.

1 filter selected

if unconnected output pin:
Connect selected filter 1st unconnected output pin with new filter first input 
pin.

else if unconnected input pin but no unconnected output pins
Connect selected filter 1st unconnected input pin with new filter first output 
pin.

2 filters selected

If selected filters are already connected to each other
Attempt to insert new filter in first connection between them as if one of 
connected pins were selected

otherwise needs further rules...

The feature is important for me because:

Faster graph building without fiddly pin navigation.

The feature is important for other users because:

Faster graph building.

Original issue reported on code.google.com by mike.cop...@gmail.com on 24 Feb 2015 at 12:59

GoogleCodeExporter commented 9 years ago
Have started implementing this and test out what connection rules work best in 
practice in graph building.

Original comment by mike.cop...@gmail.com on 24 Feb 2015 at 1:17

mikecopperwhite commented 7 years ago

Revised implementation.

Connection logic when creating new filter is created is unchanged except when there isn't a single selected pin but there is a single selected filter. In this single case the new filter is connected to the previously selected filter using the same code as connecting two selected filters with Graph/Connect.

If the filter to filter connection fails no error message is shown as the user may not have intended to make this connection so showing an error could be quite irritating. Whether or not the connection succeeds, the newly added filter becomes the single selected filter (as before).

If the user wants to insert a new filter in an existing pin connection then they can manually select either end of the pin connection before creating the new filters (as before).

I could make this behaviour optional if needed but it doesn't seem too intrusive to me as long as it doesn't show any extra error messages. Failed connection attempts should not cause bad side effects in well written filters. If the connection succeeds but is unwanted at least it's visible to the user what has happened.