Tom94 / tev

High dynamic range (HDR) image viewer for graphics people
BSD 3-Clause "New" or "Revised" License
1.02k stars 86 forks source link

Add textbox to edit image caption in the image list #208

Closed Speierers closed 1 year ago

Speierers commented 1 year ago

Overview

This PR adds the ability to edit the caption of the selected image in the image list via a new textbox added to the GUI.

image

A keybinding for the Enter key was added to trigger the focus on the caption text box for users to quickly annotate different images in the list. We also ensure that captions are preserved when reloading an image.

Example

The following screencast showcases this new feature:

https://user-images.githubusercontent.com/6662561/233287487-238a572e-e0dd-4f35-8934-c159fc3b5899.mov

wjakob commented 1 year ago

What about hiding this text box by default or realizing the feature using a hotkey-triggered modal dialog? (tev already has so many buttons and widgets on the left hand panel, and this adds further elements)

Tom94 commented 1 year ago

Thanks a bunch for the contribution, Sebastian!

I concur with Wenzel in that the additional UI element feels unnecessary. Would it be possible to make the image button turn into a textbox upon pressing the hotkey? This would signify to the user what they're actually editing here -- like this: https://user-images.githubusercontent.com/4923655/233303095-2020f7f8-9d50-4319-8a4e-f8db18f4c4d7.mov

Also, could the shortcut be F2 on Windows and Linux (which is the common "rename" shortcut on those systems) and be listed in HelpWindow.cpp?

Speierers commented 1 year ago

I agree, let's keep the UI clean.

I modified my patch so that it create a TextBox in the image list when pressing F2 to edit the image caption. To cancel, the user can simply click anywhere else on the application.

https://user-images.githubusercontent.com/6662561/233362098-a000c765-c084-4778-a5a0-198ae58e0cae.mov

Tom94 commented 1 year ago

That looks very sleek. Thanks!

Aside from UX, I've some additional concerns regarding the underlying implementation. Once those are solved this should be good to merge.

EDIT: oh, and could the text in the textbox be right-aligned, same font size as the image button, and same (background) color?

EDIT 2: I noticed you've implemented F2 even on your macOS system. I'd actually prefer if the hotkey stayed Enter on macOS and F2 was used only on Windows and Linux. This would match the behavior of other tools, like VS Code or Finder vs. Explorer.

Speierers commented 1 year ago

Thanks for your constructive feedbacks @Tom94, I indeed completely ignored the IPC feature of TEV.

I re-implemented this feature in a more self-contained manner where the ImageButton owns and manages the TextBox widget as suggested. It is not only much cleaner but should also be more robust.

I made sure the font size is similar to the one used in the ImageButton, and made the textbox right-aligned. I did not change the background color of the textbox on purpose to make it clearer to the user that he is currently editing the caption of the selected image. I hope this is fine with you.

Also as requested, the hotkey is now Enter for MacOS and F2 otherwise.

Tom94 commented 1 year ago

Thanks! I changed / added a few additional things and will merge once CI is through.

https://user-images.githubusercontent.com/4923655/233633152-125f4b8e-7735-48f1-8b89-f780cd5e594f.mov