bigdataviewer / bigdataviewer-core

ImgLib2-based viewer for registered SPIM stacks and more
BSD 2-Clause "Simplified" License
33 stars 35 forks source link

Enable Drag and Drop between different bdv windows #91

Closed NicoKiaru closed 4 years ago

NicoKiaru commented 4 years ago

The drag and drop mechanism with SourcesTransferable works within a bdv window, but it would be nice to make this work between different windows.

I think this would mean adding sources here : https://github.com/bigdataviewer/bigdataviewer-core/blob/c48ab1de3e7ae1b2a1adcb7f8149adff1d2cfb38/src/main/java/bdv/ui/sourcegrouptree/SourceGroupTree.java#L415

before adding them to a group.

If you believe that could be useful, I can try to make this work and make a PR.

NicoKiaru commented 4 years ago

It's a bit more complicated, because the convertersetups will not be transfered...

tpietzsch commented 4 years ago

@NicoKiaru One topic for multi-window usage would be to be able to share parts of ViewerState between windows (selectively, e.g., share grouping, but not convertersetups and viewertransform). I'll make a separate issue about that, I just thought of it again, because the "source renaming" also runs into that...

NicoKiaru commented 4 years ago

Ok, thanks for replying. I hope we are not going too far with @tischi and @martinschorb in bigdataviewer-playground, or that we will be able to catch the train when the partial ViewerState sharing happens.

In bdv-playground, we use exclusively SourceAndConverter and ConverterSetups, and that's how we communicate with multiple BigDataViewer instances : a single ConverterSetup is shared for all windows, the listeners of all windows are triggered when the convertersetup is changed.

I do not yet grasp what's in ViewerState which would be necessary in order to communicate to other windows (synchronization ?), but if bdv-playground do things badly, it would be good to avoid going too far.

I also noticed that in sciview @skalarproduktraum holds a reference to the ViewerState, so if that's the way to go, I'd like to be prepared to change this in bdv-playground.

tpietzsch commented 4 years ago

In bdv-playground, we use exclusively SourceAndConverter and ConverterSetups, and that's how we communicate with multiple BigDataViewer instances : a single ConverterSetup is shared for all windows, the listeners of all windows are triggered when the convertersetup is changed.

That sounds perfectly reasonable.

I do not yet grasp what's in ViewerState which would be necessary in order to communicate to other windows (synchronization ?), but if bdv-playground do things badly, it would be good to avoid going too far.

I think nothing in ViewerState is necessary to communicate. The sharing should be set up once and then happen behind the scenes autamatically. So every window just should talks to itss own ViewerPanel/ViewerState. Then windows with shared state should be automatically notified etc