Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
hi arkypita!
I recently bought a laser engraver and found your software, which performs excellently!
As a programmer, I was overjoyed to find your project is open source and written in C#,
one of my favourite languages.
So, I decided to start contributing, if you are interested in my additions/changes.
One thing I missed, is the ability to assign keyboard shortcuts to custom buttons 'by name', e.g. the 'Blink' button to preview where the laser will be aimed at the object, a very handy feature to have on the keyboard while staring through the dark laser glasses. (I have rather poor vision and need to swap out my regular glasses for the darkened ones, and then I don't see my screen very well... so keyboard shortcuts are essential to me ;-).
I discovered it was already possible to assign a keyboard shortcut to a custom button 'by number', but not 'by name' yet.
So I thought I would chip in my two cents to improve on that.
I made a few changes:
By providing a 'hotKeyName' to the CustomButton (an extra field on such a button that shows up in the Hotkey form),
I was able to differentiate the HotKeyManager between the built-in Actions (enum) and the customButton actions (by this string 'HotKeyName').
When a action is built-in, it uses this regular Actions enum, but when it's an action bound to a customButton, its Actions enum is 'None', and the HotKeyName is filled-in instead. This is the main differentiation really.
(note: I was at first tempted to simply use the Tooltip string for recognition, but that would maybe be a bit less clear to the user, to abuse that string.. so I added the 'HotKeyName' to CustomButton. It's a matter of taste I guess.)
After throwing away my old settings file from the typical Windows C://users/...../AppData/LaserGRBL folder, and letting LaserGRBL re-generate the hotkey table so I had a clean settings file, I added some custom buttons to test it.
The HotKey manager form now displays built-in actions as well as customButton actions nicely in the datagridview by name, saves them to settings as usual, etc.
I removed the provisions of the 'numbered' customButtons in the HotKeyManager's Actions enum, since they are now no longer needed, and got extended to a (hopefully ;-) more convenient solution, 'by name'.
While making this pull request, I noticed that I probably use a different Visual Studio version than you (VS2022), and also the auto-formatter of Visual Studio changed a bit more whitespace than needed, which clutters the diff of this pull-request a bit... argh!
I apologize for that, and hope you can see through it.
There's actually not that many in-depth changes if you look at the files side-by-side and don't mind the things Visual Studio changed 'automatically', the whitespace, the auto-generated WinForms files. This pull-request view looks far more dramatic than it actually is ;-)
The classes I adjusted, I also cleaned up a little, but that's just optional and a matter of taste, of course. e.g. the lambda getter features of modern C#. you might as well disregard those changes of course. It was just for my reading clarity that I cleaned up in some places.
I plan to make all kinds of additions in the future, but let's say this is a little starter for warming up to your code-base and getting to know the project ;-)
kind regards,
loki of mute