Skip to content

Add some hotkeys for markers, and display them in tool tips. #4377

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

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

Conversation

SuuperW
Copy link
Contributor

@SuuperW SuuperW commented Jun 28, 2025

Hotkeys:
Add marker (default M): Adds a marker to the emulated frame, same as the add marker button under the markers list.
Delete marker (default Ctrl+M): Deletes a marker on the emulated frame
Seek to prev/next marker (default Shift+PageUp/Down): Already existed, they are just now configurable.

Check if completed:

Copy link
Member

@YoshiRulz YoshiRulz left a comment

Choose a reason for hiding this comment

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

I don't like adding an event to Config. What if HandleHotkeyUpdate was a virtual method on ToolFormBase and you called it on all open tools at the end of this method?

private void HotkeysMenuItem_Click(object sender, EventArgs e)
{
using var hotkeyConfig = new HotkeyConfig(Config);
if (!this.ShowDialogWithTempMute(hotkeyConfig).IsOk()) return;
AddOnScreenMessage("Hotkey settings saved");
InitControls();
InputManager.SyncControls(Emulator, MovieSession, Config);
}

@SuuperW
Copy link
Contributor Author

SuuperW commented Jun 28, 2025

I think that would work, but what is wrong with using an event? Personally I think more things in BizHawk should be events. I don't like adding methods to base classes or interfaces just for them to be implemented in only a single class.

@YoshiRulz
Copy link
Member

It's applicable to other tools too. (If it was just for TAStudio, why set up multicast?)
Events add overhead and are prone to creating subtle bugs.
To guarantee the serialisation remains good, you could use an Action property, but again it really needs to be multicast because other tools could use it.

@SuuperW
Copy link
Contributor Author

SuuperW commented Jun 28, 2025

A virtual method on all tools that most tools don't use (though I don't actually know how many would actually benefit from this particular one) also adds overhead.
Events are somewhat more prone to bugs though. (I really wish handlers would be automatically removed from the event when the owning object is disposed.)

I'll switch the implementation.

@vadosnaprimer
Copy link
Contributor

I haven't checked the code but conceptually this PR makes sense. The only difference from the current workflow is that we're adding markers on selected frames using the menu, and to arbitrary frames using double-click. So these hotkeys are kinda unique in functionality by adding it on emulated frame instead. But I don't mind having options for all 3 methods of adding them.

@SuuperW
Copy link
Contributor Author

SuuperW commented Jun 28, 2025

There is already a button for adding a marker on the emulated frame, but not for removing on the emulated frame.
I could add one for adding to the selected frame too... but I feel like that's not as useful. It's also a bit ambiguous since you can have multiple frames selected. The context menu "Set Markers" option adds a marker to each selected frame which seems pointless but someone probably had a reason for implementing it.

@vadosnaprimer
Copy link
Contributor

Yeah no need for extra stuff for now.

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.

3 participants