adventuregamestudio / ags

AGS editor and engine source code
Other
701 stars 160 forks source link

Support remapping shorcuts in the Editor #2314

Open ericoporto opened 9 months ago

ericoporto commented 9 months ago

Describe the problem A person may be used to some shortcut from other editor or have some permanently open software in their computer that the shortcut clashes with an existing shortcut of AGS or they just want to change a particular shortcut for whatever reason.


Suggested change Support remapping shortcuts. The idea is to create a new tab for shortcut remapping in preferences panel.

There are a few details

Shortcut list to help finding them in the editor

https://adventuregamestudio.github.io/ags-manual/KeyboardShortcuts.html

I imagine some entity contain a bunch of properties and these properties would be of such type that they can contain the shortcut, and a string name of what the shortcut is (the "Function" column from above table). Maybe such type could be read only for some things (block selection?), and maybe they each have a set default - maybe in the UI you can set individual to default or all to default.

Is there any validation for not repeating a shortcut? What happens if you click default and the default of that conflicts with the set shortcut of something else? If someone has any idea on the design of this, I really need ideas.


Additional context First described here: https://www.adventuregamestudio.co.uk/forums/editor-development/feature-request-custom-keyboard-shortcuts/

Hello all. Right now we have commands like control-G to bring up the global script, but would it be possible to create custom keyboard shortcuts to bring up additional module scripts? There are a few that I have to open up a lot, and being able to open it with a quick keyboard shortcut would be handy. Especially since I have a lot of them buried in folders.

And while I'm here, a shortcut to automatically open the sprite or global variable tabs would be nice as well!

I parsed as three different things

Support remapping shortcuts on the AGS Editor Add a way to create custom shortcuts to open user created module scripts Add a shortcut to open Sprite Manager and a shortcut to open the Global Variables panel

ivan-mogilko commented 9 months ago

I think a good approach for this would be to introduce a concept of "Action", as something that may be run in the Editor, or particular "context" in the Editor. Then this Action may be customized by assigning a shortcut, and even allowed to be placed in a custom user-defined menu or a toolbar for a quicker access.

I don't think that defining all shortcut properties in a single entity would be convenient, in my opinion it's better to let Components define these as a list of "action" objects, and have some Manager to gather these together.

That would also allow for plugin-based components to define their own Actions and user to assign shortcuts for them.


EDIT: since there had been a talk about game "Action" some time ago, the Editor's action could have a different type name avoiding conflicts. For example, UICommand, UIAction, etc. (On a side note, it's a problem that AGS.Types does not provide separate namespace for types related to Editor itself and types related to the game data.)

linuxloot-de commented 6 months ago

I would also welcome the rearrangement of keyboard shortcuts. The most important points have already been mentioned by Érico Porto.

ericoporto commented 6 months ago

I notice now that the concept of action proposed by @ivan-mogilko feels similar (not same) to the idea for the redo/undo.

If I understood, in the case of here the actions are similar to the MenuCommand here but would instead receive a lambda and optionally some "context" to execute their command.