Pelles C forum
Pelles C => Add-ins => Topic started by: kankamuso on April 10, 2007, 01:45:35 AM
-
A simple add-in to integrate AStyle into the IDE.
Install the add-in DLL, copy astyle.exe and astyle.cfg (both included) into Pelles C bin folder, tweak astyle.cfg (optional) and you'll have "AStyle" option in the editor context menu (in "Source" menu too).
I hope this is useful for someone besides myself. Maybe someone with more C/Windows API experience could clean the code and improve things here and there. If anyone does it, please post the improved add-in here.
BTW: Is there any way to assign a keyboard shortcut to an add-in?
-
BTW: Is there any way to assign a keyboard shortcut to an add-in?
No - add-ins are too 'dynamic' by nature, so it would be hard to implement. I have never tried it, but perhaps the add-in could assign it's own key through 'subclassing' (perhaps using the UCase add-in sample as a start...?)
-
Thanks a lot, Pelle. You confirm what I thought about managing hotkeys for add-ins: it would be hard. But your suggestion was correct: I've been able to add a hard-coded hotkey through subclassing.
Greetings.
-
I wrote a small program (BeautifyPellesC.exe) to call AStyles and passing it Pelles C's current filename.
I assigned the program to a Pelles C user tool and assigned the tool a hotkey (I chose 'F12').
Screenshot of 'Edit Tool' menu and program are attached.
Simply edit the 'Command' text box with the location of BeautifyPellesC.exe.