gerritv / Grbl-Panel

A control panel for Grbl
MIT License
180 stars 102 forks source link

Added enhancement - Macro buttons #38

Closed joebananas10 closed 8 years ago

joebananas10 commented 8 years ago

Here's the long and short of it. I added three new routines to the bottom of GrblGui, MacroButtonEditorToolStripMenuItem_Click EnableMacroButtons MacroButton_Click

I also added a call to EnableMacroButtons near the bottom of grblgui_Load and a new Menu Item under Tools.

There's a new form to allow the user to edit their macros, GrblMacroButtons. This form allows the user to add, edit, and delete macro buttons. The data is stored in the system registry under HKCU\Software\GrblPanel\Macros. Only five buttons can fit in the groupbox comfortably but there's no limit to the number of macros that can be added.

The buttons are dynamically added and removed to gbMDI based on the values found in the registry. When the user clicks one of the buttons the gcode associated with that button is sent using the same mechanism as the MDI Manual Command Send.

When the user enters the Macro Button Editor the first time or if there are no buttons defined at all the editor will load itself with a sample Probe macro. This sample is not saved in the system until the user commits the sample to the registry.

Please let me know your thoughts on this.

gerritv commented 8 years ago

@joebananas10 I will review your code additions on the weekend. Sounds like an excellent solution although I might prefer to use an xml file for the configuration. Otherwise the registry entries remain even if you no longer want to use GrblPanel.

joebananas10 commented 8 years ago

I only used the registry because that's what I've been used to for the past 15+ years. I tried to figure out how to create a hierarchical structure in the XML settings that I could delete and recreate at will but I couldn't find an easy way to do it. If you know of some good documentation to help me figure it out I'd be more than happy to change it.

gerritv commented 8 years ago

Starting the merge. I have to adapt it to 1) use the config file, 2) disable capturing X, Y, Z etc while the Macro editor has focus. These keyboard actions were a recent addition to reset each axis, usually via a pendant/game controller

gerritv commented 8 years ago

Merged and adapted. I limited this to 5 macros. The macros are stored in user.config as Macro1-5. The Macro editor is now a tab along with Settings etc. Thank you for this very useful enhancement