Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Copy selection toolbar start and stop time string into clipboard #5789

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

lededev
Copy link

@lededev lededev commented Dec 14, 2023

Copy selection toolbar start and stop time string into clipboard.

Resolves: issues 5759

Double click or right click selection toolbar label, or from menu "Select" -> "Region" -> "Selection String to Clipboard", or assign a hotkey to above menu item. It output time range string like "1m3.221s-1h22m16.331s" to clipboard, and a notify from system tray.

  • I signed CLA
  • The title of the pull request describes an issue it addresses
  • If changes are extensive, then there is a sequence of easily reviewable commits
  • Each commit's message describes its purpose and effects
  • There are no behavior changes unnecessary for the stated purpose of the PR

Recommended:

  • Each commit compiles and runs on my machine without known undesirable changes of behavior

Copy selection toolbar start and stop time string into clipboard.
Double click or right click selection toolbar label, or from menu "Select" -> "Region" -> "Selection String to Clipboard", or assign a hotkey to above menu item.
It output time range string like "1m3.221s-1h22m16.331s" to clipboard.
Copy link
Member

@LWinterberg LWinterberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see a lot of potential here for a generalized form which would work on any time input, as well as copy-paste functionality which may replace the weird and invisible store/retrieve cursor and range functions. Doing that isn't necessary for this PR though.

There's a bit of UX cleanup to do for this PR. But already I can say: Thank you for this contribution!

Comment on lines 1023 to 1025
Command(wxT("SelStrToClipboard"), XXO("Selection String to &Clipboard"),
FN(OnSelStrToClipboard), AlwaysEnabledFlag,
Options{}.LongName(XO("Selection Time Range String to Clipboard")))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Copy selection timestamp" would be the better string for this function.

src/toolbars/SelectionBar.cpp Outdated Show resolved Hide resolved
src/toolbars/SelectionBar.cpp Outdated Show resolved Hide resolved
src/menus/SelectMenus.cpp Outdated Show resolved Hide resolved
@lededev
Copy link
Author

lededev commented Dec 15, 2023

Code modification completed, please review again.

@lededev
Copy link
Author

lededev commented Dec 15, 2023

Code reduce to 45 lines, please review.

@petersampsonaudacity
Copy link

petersampsonaudacity commented Dec 17, 2023

Testing on W10 with @lededev 's latest branch: audacity-win-3.5.0-alpha-20231215+5c2f507-x64

@LWinterberg

  1. I note that this is NOT "does what it says on the tin" as expressed in the title of this thread. Rather than pasting start and end selection time to the clipboard it actually pastes the two values in the Selection toolbar - and these vary according to the display format the user has chosen
    a) start and end (default)
    b) start and length
    c) length and end
    d) length and center

  2. I have managed somehow to extract enough samples to be able to post this test - BUT I am really none the wiser as to whet the UI is for pasting these values to the clipboard - not really "discoverable" at all AFAICT

@lededev
Copy link
Author

lededev commented Dec 17, 2023

That's not all, if you press the right mouse button on the time control, a menu will appear allowing you to choose more output formats. I counted 19 output formats. But don’t worry too much about side effects, because this small function only reads the string from the time control and writes it to the clipboard. The only side effect is that it will overwrite the current data of the clipboard, so I added a floating window in the system prompt bar. To prompt the user that the current data in the clipboard has changed.
What you see in the time selection bar of the user interface is what you get in the clipboard, what you see is what you get, there are no implicit changes.

@petersampsonaudacity
Copy link

petersampsonaudacity commented Dec 17, 2023

That's not all, if you press the right mouse button on the time control, a menu will appear allowing you to choose more output formats

@lededev Or left click on the little downward-pointing black triangle - know colloquially as the LDPBT ;-)

The only side effect is that it will overwrite the current data of the clipboard, so I added a floating window in the system prompt bar.

Yes, I observed the message. Are you overwriting
a) the system clipboard or,
b) the Audacity clipboard?

And can you explain what the UI actually is to this confused person please.

@petersampsonaudacity
Copy link

@lededev
Another way you could capture the start and end time of a selection is to give it a range label and then export labels to a text file.

Possibly not so good of you already have a lot of labels.

@lededev
Copy link
Author

lededev commented Dec 18, 2023

@petersampsonaudacity You can press Win+V shortcuts on windows 10 to see them in system clipboard but not paste them.

I want to simplify my steps rather than make things more complicated, so exporting a text file and opening it in an editor is contrary to my idea. If I need to save the data, I'll paste it into my notepad and then Ctrl+S to save.
In fact, I have already done this. In my modified version Notepad3 with name NotepadEE, I only need to press Alt+2, and the contents of the audacity time selection box will be inserted into my notepad text. I can then save the data or perform time expression calculations.
1ntee

@petersampsonaudacity
Copy link

@petersampsonaudacity You can press Win+V shortcuts on windows 10 to see them in system clipboard but not paste them.

@lededev what I mean is what do I have to do in Audacity to get the selection toolbar contents copied to the clipboard?

@lededev
Copy link
Author

lededev commented Dec 18, 2023

@petersampsonaudacity You can press Win+V shortcuts on windows 10 to see them in system clipboard but not paste them.

@lededev what I mean is what do I have to do in Audacity to get the selection toolbar contents copied to the clipboard?

There are 3 ways currently:

  1. Main menu -> Select -> Copy Selection Timestamp
  2. Right click label "Selection" on selection toolbar
  3. Ctrl+P open Preferences, click Shortcuts, Search "times", Set a shortcut to "Copy Selection Timestamp".

@petersampsonaudacity
Copy link

petersampsonaudacity commented Dec 18, 2023

2. Right click label "Selection" on selection toolbar

Rather than "hiding" it there - why not add it as an extra item to the menu you get when left-clicking the cog-wheel?

@LWinterberg does that seem sensible to you? Apart from any other consideration right-click is more normally used as a gesture to summon a context menu.
It's certainly where I first went looking for it ...

image

@lededev
Copy link
Author

lededev commented Dec 18, 2023

  1. Right click label "Selection" on selection toolbar

Rather than "hiding" it there - why not add it as an extra item to the menu you get when left-clicking the cog-wheel?

@LWinterberg does that seem sensible to you? Apart from any other consideration right-click is more normally used as a gesture to summon a context menu. It's certainly where I first went looking for it ...

If you put it there, you need 4 actions to complete this operation. Move, click, move, click. And it will make the audio selection area lose focus. Might as well click on the main menu to do this.
My method is faster and requires only 2 actions, move and right click.

Considering that I also need to copy it to Notepad, there are 4 keys including Alt+TAB and Ctrl+V, or pure mouse actions also 4: move to notepad insert location, click, hold right mouse button and down gresture(paste), which require a total of 6 actions (8 actions using your method). Since my NotepadEE has added the Alt+2 function to do this, it only requires 4 actions in total, Alt+TAB, Alt+2.

I feel that if the operation is made too complex, I will be less interested in adding this small feature.

@LWinterberg
Copy link
Member

I think the issue we're running into here is that there's a discontinuity between "feature which makes my life easier" and "feature which fits into Audacity". I totally see your point that right-clicking the label makes things very fast for you.

However, in the context of Audacity and its millions of users, there are different constraints in place, which require compromise. One of these constraints is learnability and intuitiveness of the app. Peter had the intuitive sense to look inside the selections gear to look for a copy option, so that could be argued as a sensible place to put this option. There would be other places too which would work intuitively for some people (ie Ctrl+C - except that it clashes with us not having scoped shortcuts for most things, selection menu, context menu on the time display itself), and unfortunately, right-clicking or double-clicking the label to copy something else is just not something intuitive. And it's also not learnable as it's completely invisible and also the only place in the entire app that would do right-click copy. In fact, it would be unique among all apps I'm aware of; the only thing that comes close is some terminals using right-click to paste.

So unfortunately, right-click copy is blocking the merge here.

Again, the feature itself is a good fit for Audacity, and if put on a shortcut, it's be pretty fast as well.

@lededev
Copy link
Author

lededev commented Dec 19, 2023

@LWinterberg xterm use right click copy select text, cmd.exe also use right click copy select text. Therefore, right-click copying is also a habitual operation for many users.

@LWinterberg
Copy link
Member

Audacity is not a terminal program though, and most of its users have never opened a terminal.

@lededev
Copy link
Author

lededev commented Dec 19, 2023

Audacity is not a terminal program though, and most of its users have never opened a terminal.

I am not sure about this, but I think the right-click is no harm with the uses who do not use right-click copy, But it can bring convenience to users who are used to this kind of operation. It is harmless to one party and beneficial to the other party, so I prefer to retain this feature rather than remove it.

@petersampsonaudacity
Copy link

petersampsonaudacity commented Dec 19, 2023

It is harmless to one party and beneficial to the other party, so I prefer to retain this feature rather than remove it.

Yes, it's harmless there - but as Leo says it ain't "discoverable there, especially limited to the "Selection" text in the toolbar.

Perhaps if you increased the target for the right click then users who may think to try for a context menu will stumble across it
image

That's something I certainly tried and failed - it was only when I happened to be over the "Selection" text when I right-clicked that I got to copy dialog - but I failed to infer that that was the small target area.

=================================================

You can't extend the right-click target further rightwards in the tool as as right-clicking in the two number zones brings up a context menu for display type
image

@lededev
Copy link
Author

lededev commented Dec 19, 2023

@petersampsonaudacity Regarding the problem that it is difficult for users to find this right-click function, I think a mouse hover prompt can be added. When the mouse hovers over the "Selection" label for a period of time, a floating tooltip will be given to prompt the user to right click to copy the timestamp.
rtooltip

@lededev lededev force-pushed the clipRange2clipboard branch 2 times, most recently from 677e136 to 9e16503 Compare December 19, 2023 15:52
@Pavelrst
Copy link

@lededev Hi, where is it possible to get a version of Audacity that has this feature?

as a Audacity user I completely agree with all your suggestions btw.

@lededev
Copy link
Author

lededev commented Mar 15, 2024

Hi, where is it possible to get a version of Audacity that has this feature?

as a Audacity user I completely agree with all your suggestions btw.

You can download official audacity 3.4.2 Windows x64 zip, and overwrite Audacity.exe with my patch, but this patch only have right/double click label "Selection" on selection toolbar copy time string to clipboard feature, no menuitem and shortcut. I will make new patch if 3.5 release without this feature.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Copy selection toolbar data time string into clipboard
5 participants