morphonets / SNT

The ImageJ framework for quantification of neuronal anatomy
https://imagej.net/plugins/snt
GNU General Public License v3.0
42 stars 18 forks source link

Feature request: CTRL+S to save .traces #158

Closed carshadi closed 1 year ago

carshadi commented 1 year ago

It would be convenient to press CTRL+S and have the save traces dialog appear. As a rough prototype, I added a key binding to the PathManagerUI JScrollPane which listens for CTRL+S when the window containing the scroll pane is in focus (i.e., when any component of PathManagerUI is selected), see https://github.com/morphonets/SNT/commit/3e79044d8cb8d1a541f2ba5b7bf46e4ce4eae15a

I would pull out the anonymous AbstractAction into it's own class, which could then be used by both SNTUI and PathManagerUI for saving traces. It seems to work well enough, but I worry that users may get confused since when the image is in focus, CTRL+S opens the image saving dialog instead. They would need to remember to click the Path Manager UI each time.

It would probably also make sense to add a listener to the main SNT dialog as well, @tferr what do you think?

tferr commented 1 year ago

It is a good idea. A couple of notes:

We are already using S for the cursor snapping. So S alone will not work as-is. Alternatively, we could use Shift+S, but Shift+key combos feel unexpected!? Ctrl/Cmd+ S is such a universal keystroke that it would be a pity not to use it?

carshadi commented 1 year ago

@tferr I moved it to QueueJumpingKeyListener and it seems to work. It overrides the ImageJ "Save As Tiff..." prompt when triggered from the canvas, but not from the main ImageJ dialog, which seems reasonable to me. Having the Path Manger selected now doesn't trigger the save, which I guess is OK?